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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js

Issue 1458463002: Add some missing null checks in chromevox next. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview The entry point for all ChromeVox2 related code for the 6 * @fileoverview The entry point for all ChromeVox2 related code for the
7 * background page. 7 * background page.
8 */ 8 */
9 9
10 goog.provide('Background'); 10 goog.provide('Background');
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 chrome.automation.addTreeChangeObserver(this.onTreeChange); 128 chrome.automation.addTreeChangeObserver(this.onTreeChange);
129 }; 129 };
130 130
131 Background.prototype = { 131 Background.prototype = {
132 /** Forces ChromeVox Next to be active for all tabs. */ 132 /** Forces ChromeVox Next to be active for all tabs. */
133 forceChromeVoxNextActive: function() { 133 forceChromeVoxNextActive: function() {
134 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT); 134 this.setChromeVoxMode(ChromeVoxMode.FORCE_NEXT);
135 }, 135 },
136 136
137 /** @type {ChromeVoxMode} */
137 get mode() { 138 get mode() {
138 return this.mode_; 139 return this.mode_;
139 }, 140 },
140 141
142 /** @type {cursors.Range} */
141 get currentRange() { 143 get currentRange() {
142 return this.currentRange_; 144 return this.currentRange_;
143 }, 145 },
144 146
145 set currentRange(value) { 147 set currentRange(value) {
146 if (!value) 148 if (!value)
147 return; 149 return;
148 150
149 this.currentRange_ = value; 151 this.currentRange_ = value;
150 }, 152 },
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 chrome.tabs.query({active: true}, function(tabs) { 601 chrome.tabs.query({active: true}, function(tabs) {
600 if (mode === ChromeVoxMode.CLASSIC) { 602 if (mode === ChromeVoxMode.CLASSIC) {
601 // Generally, we don't want to inject classic content scripts as it is 603 // Generally, we don't want to inject classic content scripts as it is
602 // done by the extension system at document load. The exception is when 604 // done by the extension system at document load. The exception is when
603 // we toggle classic on manually as part of a user command. 605 // we toggle classic on manually as part of a user command.
604 if (opt_injectClassic) 606 if (opt_injectClassic)
605 cvox.ChromeVox.injectChromeVoxIntoTabs(tabs); 607 cvox.ChromeVox.injectChromeVoxIntoTabs(tabs);
606 } else { 608 } else {
607 // When in compat mode, if the focus is within the desktop tree proper, 609 // When in compat mode, if the focus is within the desktop tree proper,
608 // then do not disable content scripts. 610 // then do not disable content scripts.
609 if (this.currentRange_.start.node.root.role == 'desktop') 611 if (this.currentRange_ &&
612 this.currentRange_.start.node.root.role == RoleType.desktop)
610 return; 613 return;
611 614
612 this.disableClassicChromeVox_(); 615 this.disableClassicChromeVox_();
613 } 616 }
614 }.bind(this)); 617 }.bind(this));
615 618
616 this.mode_ = mode; 619 this.mode_ = mode;
617 }, 620 },
618 621
619 /** 622 /**
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&') 685 return glob.replace(/[.+^$(){}|[\]\\]/g, '\\$&')
683 .replace(/\*/g, '.*') 686 .replace(/\*/g, '.*')
684 .replace(/\?/g, '.'); 687 .replace(/\?/g, '.');
685 }).join('|') + ')$'); 688 }).join('|') + ')$');
686 }; 689 };
687 690
688 /** @type {Background} */ 691 /** @type {Background} */
689 global.backgroundObj = new Background(); 692 global.backgroundObj = new Background();
690 693
691 }); // goog.scope 694 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/desktop_automation_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698