Commit 3e9fff34 authored by dtseng's avatar dtseng Committed by Commit bot

Enable runtime switching between ChromeVox and ChromeVox next via command line.

Review URL: https://codereview.chromium.org/584313003

Cr-Commit-Position: refs/heads/master@{#296417}
parent c2d834b3
...@@ -1501,10 +1501,6 @@ ...@@ -1501,10 +1501,6 @@
# chrome/third_party/chromevox. This is still experimental. # chrome/third_party/chromevox. This is still experimental.
'use_migrated_chromevox%': 1, 'use_migrated_chromevox%': 1,
# Chrome OS: whether to also build the upcoming version of
# ChromeVox, which can then be enabled via a command-line switch.
'use_chromevox_next%': 0,
'conditions': [ 'conditions': [
# Enable the Syzygy optimization step for the official builds. # Enable the Syzygy optimization step for the official builds.
['OS=="win" and buildtype=="Official" and syzyasan!=1', { ['OS=="win" and buildtype=="Official" and syzyasan!=1', {
......
...@@ -340,14 +340,24 @@ void ComponentLoader::AddChromeVoxExtension( ...@@ -340,14 +340,24 @@ void ComponentLoader::AddChromeVoxExtension(
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::FilePath resources_path; base::FilePath resources_path;
PathService::Get(chrome::DIR_RESOURCES, &resources_path); PathService::Get(chrome::DIR_RESOURCES, &resources_path);
base::FilePath chromevox_path = base::FilePath chromevox_path =
resources_path.Append(extension_misc::kChromeVoxExtensionPath); resources_path.Append(extension_misc::kChromeVoxExtensionPath);
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const CommandLine* command_line = CommandLine::ForCurrentProcess();
const char* manifest_filename = bool is_chromevox_next =
command_line->HasSwitch(chromeos::switches::kGuestSession) ? command_line->HasSwitch(chromeos::switches::kEnableChromeVoxNext);
extension_misc::kChromeVoxGuestManifestFilename : bool is_guest = command_line->HasSwitch(chromeos::switches::kGuestSession);
extension_misc::kChromeVoxManifestFilename; const char* manifest_filename;
if (is_chromevox_next) {
manifest_filename =
is_guest ? extension_misc::kChromeVoxNextGuestManifestFilename
: extension_misc::kChromeVoxNextManifestFilename;
} else {
manifest_filename =
is_guest ? extension_misc::kChromeVoxGuestManifestFilename
: extension_misc::kChromeVoxManifestFilename;
}
BrowserThread::PostTaskAndReplyWithResult( BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::FILE, BrowserThread::FILE,
FROM_HERE, FROM_HERE,
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
'chromevox_resources', 'chromevox_resources',
'chromevox_manifest', 'chromevox_manifest',
'chromevox_guest_manifest', 'chromevox_guest_manifest',
'chromevox2',
], ],
}, },
{ {
...@@ -140,6 +141,70 @@ ...@@ -140,6 +141,70 @@
}, },
], ],
}, },
{
'target_name': 'chromevox2',
'type': 'none',
'dependencies': [
'chromevox2_copied_scripts',
'chromevox2_deps',
'chromevox2_manifest',
'chromevox2_guest_manifest',
'chromevox2_resources',
],
},
{
'target_name': 'chromevox2_copied_scripts',
'type': 'none',
'variables': {
'dest_dir': '<(chromevox_dest_dir)',
},
'sources': [
'cvox2/background/loader.js',
],
'includes': [ 'copy_js.gypi', ],
},
{
'target_name': 'chromevox2_deps',
'type': 'none',
'variables': {
'deps_js_output_file': '<(chromevox_dest_dir)/deps.js',
},
'sources': [
'cvox2/background/loader.js',
],
'includes': ['generate_deps.gypi'],
},
{
'target_name': 'chromevox2_resources',
'type': 'none',
'copies': [
{
'destination': '<(PRODUCT_DIR)/resources/chromeos/chromevox/cvox2/background',
'files': [
'cvox2/background/background.html',
],
},
],
},
{
'target_name': 'chromevox2_manifest',
'type': 'none',
'variables': {
'output_manifest_path': '<(chromevox_dest_dir)/manifest_next.json',
'use_chromevox_next': 1,
},
'includes': [ 'generate_manifest.gypi', ],
},
{
'target_name': 'chromevox2_guest_manifest',
'type': 'none',
'variables': {
'output_manifest_path': '<(chromevox_dest_dir)/manifest_next_guest.json',
'is_guest_manifest': 1,
'use_chromevox_next': 1,
},
'includes': [ 'generate_manifest.gypi', ],
},
], ],
'conditions': [ 'conditions': [
['use_migrated_chromevox==1 and chromevox_compress_js==1', { ['use_migrated_chromevox==1 and chromevox_compress_js==1', {
......
...@@ -142,6 +142,7 @@ ...@@ -142,6 +142,7 @@
'common/spannable_test.unitjs', 'common/spannable_test.unitjs',
'chromevox/injected/event_watcher_test.unitjs', 'chromevox/injected/event_watcher_test.unitjs',
'chromevox/injected/live_regions_test.unitjs', 'chromevox/injected/live_regions_test.unitjs',
'cvox2/background/background.extjs',
'host/chrome/braille_display_manager_test.unitjs', 'host/chrome/braille_display_manager_test.unitjs',
'host/chrome/braille_input_handler_test.unitjs', 'host/chrome/braille_input_handler_test.unitjs',
'host/chrome/braille_integration_test.unitjs', 'host/chrome/braille_integration_test.unitjs',
...@@ -159,11 +160,6 @@ ...@@ -159,11 +160,6 @@
'walkers/table_walker_test.unitjs', 'walkers/table_walker_test.unitjs',
'walkers/word_walker_test.unitjs', 'walkers/word_walker_test.unitjs',
], ],
'conditions': [
['use_chromevox_next==1', {
'sources': ['../chromevox2/cvox2/background/background.extjs'],
}],
],
}, # target chromevox_tests }, # target chromevox_tests
{ {
'target_name': 'chromevox_test_messages_js', 'target_name': 'chromevox_test_messages_js',
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
// Include test fixture. // Include test fixture.
GEN_INCLUDE(['../../../chromevox/testing/chromevox_e2e_test_base.js']); GEN_INCLUDE(['../../testing/chromevox_e2e_test_base.js']);
/** /**
* Test fixture for cvox2.Background. * Test fixture for cvox2.Background.
...@@ -15,6 +15,24 @@ function BackgroundTest() {} ...@@ -15,6 +15,24 @@ function BackgroundTest() {}
BackgroundTest.prototype = { BackgroundTest.prototype = {
__proto__: ChromeVoxE2ETest.prototype, __proto__: ChromeVoxE2ETest.prototype,
// This method is called without a |this| instance bound.
/** @override */
testGenCppIncludes: function() {
ChromeVoxE2ETest.prototype.testGenCppIncludes.call(this);
GEN('#include "base/command_line.h"');
GEN('#include "chromeos/chromeos_switches.h"');
},
// This method is called without a |this| instance bound.
/** @override */
testGenPreamble: function() {
GEN_BLOCK(function() {/*!
CommandLine* command_line = CommandLine::ForCurrentProcess();
command_line->AppendSwitch(chromeos::switches::kEnableChromeVoxNext);
*/});
ChromeVoxE2ETest.prototype.testGenPreamble.call(this);
},
/** @override */ /** @override */
setUp: function() { setUp: function() {
this.mockTts = new MockTts(); this.mockTts = new MockTts();
......
...@@ -9,16 +9,18 @@ ...@@ -9,16 +9,18 @@
# template_manifest_path: a valid Jinja2 file path. # template_manifest_path: a valid Jinja2 file path.
# output_manifest_path: file path for the resulting manifest. # output_manifest_path: file path for the resulting manifest.
# #
# The following variable is optional: # The following variables are optional:
# #
# guest_manifest: 1 or 0; generates a manifest usable while in guest # guest_manifest: 1 or 0; generates a manifest usable while in guest
# mode. # mode.
# use_chromevox_next: 1 or 0; generates a manifest for ChromeVox next.
{ {
'variables': { 'variables': {
'generate_manifest_script_path': 'tools/generate_manifest.py', 'generate_manifest_script_path': 'tools/generate_manifest.py',
'is_guest_manifest%': 0, 'is_guest_manifest%': 0,
'key': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDltVl1k15pjRzuZfMc3B69inxwm2bZeZ2O8/zFO+NluHnBm3GJ3fzdOoFGJd+M16I8p7zxxQyHeDMfWYASyCeB8XnUEDKjqNLQfCnncsANzHsYoEbYj2nEUML2P13b9q+AAvpCBpAJ4cZp81e9n1y/vbSXHE4385cgkKueItzikQIDAQAB', 'key': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDltVl1k15pjRzuZfMc3B69inxwm2bZeZ2O8/zFO+NluHnBm3GJ3fzdOoFGJd+M16I8p7zxxQyHeDMfWYASyCeB8XnUEDKjqNLQfCnncsANzHsYoEbYj2nEUML2P13b9q+AAvpCBpAJ4cZp81e9n1y/vbSXHE4385cgkKueItzikQIDAQAB',
'use_chromevox_next%': 0,
}, },
'includes': [ 'includes': [
'../../../../../build/util/version.gypi', '../../../../../build/util/version.gypi',
......
...@@ -23,8 +23,14 @@ import sys ...@@ -23,8 +23,14 @@ import sys
import tempfile import tempfile
from zipfile import ZipFile from zipfile import ZipFile
# A list of files to exclude from the webstore build. # A list of files (or directories) to exclude from the webstore build.
EXCLUDE_FILES = ['manifest_guest.json'] EXCLUDE_PATHS = [
'cvox2/background/',
'deps.js',
'manifest_guest.json',
'manifest_next.json',
'manifest_next_guest.json'
]
def CreateOptionParser(): def CreateOptionParser():
...@@ -91,9 +97,11 @@ def main(): ...@@ -91,9 +97,11 @@ def main():
with ZipFile(output_path, 'w') as zip: with ZipFile(output_path, 'w') as zip:
for root, dirs, files in os.walk(extension_path): for root, dirs, files in os.walk(extension_path):
rel_path = os.path.join(os.path.relpath(root, extension_path), '') rel_path = os.path.join(os.path.relpath(root, extension_path), '')
if rel_path in EXCLUDE_PATHS:
continue
for extension_file in files: for extension_file in files:
if extension_file in EXCLUDE_FILES: if extension_file in EXCLUDE_PATHS:
continue continue
if extension_file == 'manifest.json': if extension_file == 'manifest.json':
new_file = tempfile.NamedTemporaryFile(mode='w+a', bufsize=0) new_file = tempfile.NamedTemporaryFile(mode='w+a', bufsize=0)
......
aboxhall@chromium.org
dmazzoni@chromium.org
dtseng@chromium.org
plundblad@chromium.org
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['chromeos==1 and disable_nacl==0 and disable_nacl_untrusted==0', {
'includes': [ '../chromevox/common.gypi', ],
'targets': [
{
'target_name': 'chromevox2',
'type': 'none',
'dependencies': [
'chromevox2_copied_scripts',
'chromevox2_deps',
'chromevox2_manifest',
'chromevox2_guest_manifest',
'chromevox2_resources',
'../chromevox/chromevox.gyp:chromevox_resources',
],
},
{
'target_name': 'chromevox2_copied_scripts',
'type': 'none',
'variables': {
'dest_dir': '<(chromevox_dest_dir)',
},
'sources': [
'cvox2/background/loader.js',
],
'includes': [ '../chromevox/copy_js.gypi', ],
},
{
'target_name': 'chromevox2_deps',
'type': 'none',
'variables': {
'deps_js_output_file': '<(chromevox_dest_dir)/deps.js',
},
'sources': [
'cvox2/background/loader.js',
],
'includes': ['../chromevox/generate_deps.gypi'],
},
{
'target_name': 'chromevox2_resources',
'type': 'none',
'copies': [
{
'destination': '<(PRODUCT_DIR)/resources/chromeos/chromevox/cvox2/background',
'files': [
'cvox2/background/background.html',
],
},
],
},
{
'target_name': 'chromevox2_manifest',
'type': 'none',
'variables': {
'output_manifest_path': '<(chromevox_dest_dir)/manifest.json'
},
'includes': [ '../chromevox/generate_manifest.gypi', ],
},
{
'target_name': 'chromevox2_guest_manifest',
'type': 'none',
'variables': {
'output_manifest_path': '<(chromevox_dest_dir)/manifest_guest.json',
'is_guest_manifest': 1,
},
'includes': [ '../chromevox/generate_manifest.gypi', ],
},
],
}],
],
}
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview The entry point for all ChromeVox2 related code for the
* injected content script.
* This script will temporarily forward any events we need during the
* ChromeVox/ChromeVox2 timeframe where extension APIs do not exist (e.g.
* keyboard events).
*/
goog.provide('cvox2.Injected');
var port = chrome.extension.connect({name: 'chromevox2'});
document.body.addEventListener('keydown', function(evt) {
port.postMessage({keydown: evt.keyCode});
}, true);
...@@ -111,17 +111,8 @@ ...@@ -111,17 +111,8 @@
], ],
}], }],
['chromeos==1 and disable_nacl==0 and disable_nacl_untrusted==0', { ['chromeos==1 and disable_nacl==0 and disable_nacl_untrusted==0', {
'conditions': [ 'dependencies': [
# TODO(dtseng): Remove use_chromevox_next once ChromeVox Next is ready for testing. 'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',
['use_chromevox_next==1', {
'dependencies': [
'browser/resources/chromeos/chromevox2/chromevox.gyp:chromevox2',
],
}, { # else use_chromevox_next == 0
'dependencies': [
'browser/resources/chromeos/chromevox/chromevox.gyp:chromevox',
],
}],
], ],
}], }],
['enable_extensions==1', { ['enable_extensions==1', {
......
...@@ -66,6 +66,8 @@ const char kChromeVoxExtensionId[] = ...@@ -66,6 +66,8 @@ const char kChromeVoxExtensionId[] =
const char kChromeVoxExtensionPath[] = "chromeos/chromevox"; const char kChromeVoxExtensionPath[] = "chromeos/chromevox";
const char kChromeVoxManifestFilename[] = "manifest.json"; const char kChromeVoxManifestFilename[] = "manifest.json";
const char kChromeVoxGuestManifestFilename[] = "manifest_guest.json"; const char kChromeVoxGuestManifestFilename[] = "manifest_guest.json";
const char kChromeVoxNextManifestFilename[] = "manifest_next.json";
const char kChromeVoxNextGuestManifestFilename[] = "manifest_next_guest.json";
const char kBrailleImeExtensionId[] = const char kBrailleImeExtensionId[] =
"jddehjeebkoimngcbdkaahpobgicbffp"; "jddehjeebkoimngcbdkaahpobgicbffp";
const char kBrailleImeExtensionPath[] = const char kBrailleImeExtensionPath[] =
......
...@@ -206,6 +206,10 @@ extern const char kChromeVoxExtensionPath[]; ...@@ -206,6 +206,10 @@ extern const char kChromeVoxExtensionPath[];
extern const char kChromeVoxManifestFilename[]; extern const char kChromeVoxManifestFilename[];
// Name of ChromeVox guest manifest file. // Name of ChromeVox guest manifest file.
extern const char kChromeVoxGuestManifestFilename[]; extern const char kChromeVoxGuestManifestFilename[];
// Name of ChromeVox next manifest file.
extern const char kChromeVoxNextManifestFilename[];
// Name of ChromeVox next guest manifest file.
extern const char kChromeVoxNextGuestManifestFilename[];
// Extension id, path (relative to |chrome::DIR_RESOURCES|) and IME engine // Extension id, path (relative to |chrome::DIR_RESOURCES|) and IME engine
// id for the builtin-in Braille IME extension. // id for the builtin-in Braille IME extension.
extern const char kBrailleImeExtensionId[]; extern const char kBrailleImeExtensionId[];
......
...@@ -69,8 +69,7 @@ const char kDisableNetworkPortalNotification[] = ...@@ -69,8 +69,7 @@ const char kDisableNetworkPortalNotification[] =
// Enables switching between different cellular carriers from the UI. // Enables switching between different cellular carriers from the UI.
const char kEnableCarrierSwitching[] = "enable-carrier-switching"; const char kEnableCarrierSwitching[] = "enable-carrier-switching";
// Enables the next generation version of ChromeVox. Only valid with // Enables the next generation version of ChromeVox.
// use_chromevox_next=1 within your GYP_DEFINES.
const char kEnableChromeVoxNext[] = "enable-chromevox-next"; const char kEnableChromeVoxNext[] = "enable-chromevox-next";
// Enables consumer management, which allows user to enroll, remotely lock and // Enables consumer management, which allows user to enroll, remotely lock and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment