Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5418)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js

Issue 2654983003: Panel string changes (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
index ac9318b473d4ba26b11bf0699615829630331a45..4e67530a54b00adfd272b26488adfcf09ca7a11d 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js
@@ -32,7 +32,19 @@ Panel.Mode = {
COLLAPSED: 'collapsed',
FOCUSED: 'focused',
FULLSCREEN_MENUS: 'menus',
- FULLSCREEN_TUTORIAL: 'tutorial'
+ FULLSCREEN_TUTORIAL: 'tutorial',
+ SEARCH: 'search'
+};
+
+/**
+ * @type {!Object<string, {title: string, location: (string|undefined)}>}
+ */
+Panel.ModeInfo = {
+ collapsed: {title: 'panel_title', location: '#'},
+ focused: {title: 'panel_title', location: '#focus'},
+ menus: {title: 'panel_menus_title', location: '#fullscreen'},
+ tutorial: {title: 'panel_tutorial_title', location: '#fullscreen'},
+ search: {title: 'panel_title', location: '#focus'}
};
/**
@@ -95,13 +107,6 @@ Panel.init = function() {
this.menusEnabled_ = localStorage['useNext'] == 'true';
/**
- * True if we're currently in incremental search mode.
- * @type {boolean}
- * @private
- */
- this.searching_ = false;
-
- /**
* @type {Tutorial}
* @private
*/
@@ -146,7 +151,7 @@ Panel.init = function() {
* Update the display based on prefs.
*/
Panel.updateFromPrefs = function() {
- if (Panel.searching_) {
+ if (Panel.mode_ == Panel.Mode.SEARCH) {
this.speechContainer_.hidden = true;
this.brailleContainer_.hidden = true;
this.searchContainer_.hidden = false;
@@ -258,21 +263,8 @@ Panel.setMode = function(mode) {
this.mode_ = mode;
- if (this.mode_ == Panel.Mode.FULLSCREEN_MENUS ||
- this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL) {
- // Change the url fragment to 'fullscreen', which signals the native
- // host code to make the window fullscreen and give it focus.
- window.location = '#fullscreen';
- } else if (this.mode_ == Panel.Mode.FOCUSED) {
- // Change the url fragment to 'focus', which signals the native
- // host code to give the window focus.
- window.location = '#focus';
- } else {
- // Remove the url fragment, which signals the native host code to
- // collapse the panel to its normal size and cause it to lose focus.
- window.location = '#';
- }
-
+ document.title = Msgs.getMsg(Panel.ModeInfo[this.mode_].title);
+ window.location = Panel.ModeInfo[this.mode_].location;
$('main').hidden = (this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL);
$('menus_background').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_MENUS);
$('tutorial').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_TUTORIAL);
@@ -427,11 +419,10 @@ Panel.onOpenMenus = function(opt_event, opt_activateMenuTitle) {
/** Open incremental search. */
Panel.onSearch = function() {
+ Panel.setMode(Panel.Mode.SEARCH);
Panel.clearMenus();
Panel.pendingCallback_ = null;
- Panel.searching_ = true;
Panel.updateFromPrefs();
- Panel.setMode(Panel.Mode.FOCUSED);
ISearchUI.init(Panel.searchInput_);
};

Powered by Google App Engine
This is Rietveld 408576698