[ChromeVox] Clean up background class
This CL removes some unused code from the ChromeVox background class and
the ChromeVox classic_background class.
AX-Relnotes: n/a.
Bug: none.
Change-Id: I4bf3a3e02d211beafd5989525e40c50691458fcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3594391
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Auto-Submit: Anastasia Helfinstein <anastasi@google.com>
Reviewed-by: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#996937}
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js
index eb48cf9d..362d770 100644
--- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js
+++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/background.js
@@ -22,7 +22,7 @@
import {RangeAutomationHandler} from './range_automation_handler.js';
/**
- * @fileoverview The entry point for all ChromeVox2 related code for the
+ * @fileoverview The entry point for all ChromeVox related code for the
* background page.
*/
@@ -32,9 +32,7 @@
const RoleType = chrome.automation.RoleType;
const StateType = chrome.automation.StateType;
-/**
- * ChromeVox2 background page.
- */
+/** ChromeVox background page. */
export class Background extends ChromeVoxState {
constructor() {
super();
@@ -59,25 +57,13 @@
Object.defineProperty(ChromeVox, 'typingEcho', {
get() {
- return parseInt(localStorage['typingEcho'], 10);
- },
- set(v) {
- localStorage['typingEcho'] = v;
- }
- });
-
- Object.defineProperty(ChromeVox, 'typingEcho', {
- get() {
- const typingEcho = parseInt(localStorage['typingEcho'], 10) || 0;
- return typingEcho;
+ return parseInt(localStorage['typingEcho'], 10) || 0;
},
set(value) {
localStorage['typingEcho'] = value;
}
});
- ExtensionBridge.addMessageListener(this.onMessage_);
-
/** @type {!BackgroundKeyboardHandler} @private */
this.keyboardHandler_ = new BackgroundKeyboardHandler();
@@ -120,9 +106,7 @@
ChromeVox.tts.speak(announceText.join(' '), QueueMode.FLUSH);
});
chrome.accessibilityPrivate.onCustomSpokenFeedbackToggled.addListener(
- (enabled) => {
- this.talkBackEnabled = enabled;
- });
+ (enabled) => this.talkBackEnabled = enabled);
chrome.accessibilityPrivate.onShowChromeVoxTutorial.addListener(() => {
(new PanelCommand(PanelCommandType.TUTORIAL)).send();
});
@@ -132,9 +116,7 @@
sessionStorage.setItem('darkScreen', 'false');
}
- /**
- * @override
- */
+ /** @override */
getCurrentRange() {
if (this.currentRange_ && this.currentRange_.isValid()) {
return this.currentRange_;
@@ -142,9 +124,7 @@
return null;
}
- /**
- * @override
- */
+ /** @override */
getCurrentRangeWithoutRecovery() {
return this.currentRange_;
}
@@ -297,48 +277,12 @@
}
}
- /**
- * Open the options page in a new tab.
- */
- showOptionsPage() {
- const optionsPage = {url: '/chromevox/options/options.html'};
- chrome.tabs.create(optionsPage);
- }
-
- /**
- * @override
- */
+ /** @override */
onBrailleKeyEvent(evt, content) {
return BrailleCommandHandler.onBrailleKeyEvent(evt, content);
}
- /**
- * @param {Object} msg A message sent from a content script.
- * @param {Port} port
- * @private
- */
- onMessage_(msg, port) {
- const target = msg['target'];
- const action = msg['action'];
-
- switch (target) {
- case 'next':
- if (action === 'getIsClassicEnabled') {
- const url = msg['url'];
- const isClassicEnabled = false;
- port.postMessage({target: 'next', isClassicEnabled});
- } else if (action === 'onCommand') {
- CommandHandlerInterface.instance.onCommand(msg['command']);
- } else if (action === 'flushNextUtterance') {
- Output.forceModeForNextSpeechUtterance(QueueMode.FLUSH);
- }
- break;
- }
- }
-
- /**
- * @override
- */
+ /** @override */
restoreLastValidRangeIfNeeded() {
// Never restore range when TalkBack is enabled as commands such as
// Search+Left, go directly to TalkBack.
@@ -346,7 +290,6 @@
return;
}
-
if (!this.currentRange_ || !this.currentRange_.isValid()) {
this.setCurrentRange(this.previousRange_);
}
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox_state.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox_state.js
index 52f4cce..0e0b601 100644
--- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox_state.js
+++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/chromevox_state.js
@@ -30,7 +30,7 @@
};
/**
- * ChromeVox2 state object.
+ * ChromeVox state object.
* @constructor
*/
ChromeVoxState = function() {
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js
index 945605c..f332c87 100644
--- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js
+++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/classic_background.js
@@ -274,24 +274,6 @@
switch (target) {
case 'TTS':
- if (msg['startCallbackId'] !== undefined) {
- msg['properties']['startCallback'] = function(opt_cleanupOnly) {
- port.postMessage({
- 'message': 'TTS_CALLBACK',
- 'cleanupOnly': opt_cleanupOnly,
- 'id': msg['startCallbackId']
- });
- };
- }
- if (msg['endCallbackId'] !== undefined) {
- msg['properties']['endCallback'] = function(opt_cleanupOnly) {
- port.postMessage({
- 'message': 'TTS_CALLBACK',
- 'cleanupOnly': opt_cleanupOnly,
- 'id': msg['endCallbackId']
- });
- };
- }
try {
this.onTtsMessage(msg);
} catch (err) {
diff --git a/chrome/browser/resources/chromeos/accessibility/chromevox/background/live_regions.js b/chrome/browser/resources/chromeos/accessibility/chromevox/background/live_regions.js
index cfc91d3e..3dc9014 100644
--- a/chrome/browser/resources/chromeos/accessibility/chromevox/background/live_regions.js
+++ b/chrome/browser/resources/chromeos/accessibility/chromevox/background/live_regions.js
@@ -14,7 +14,7 @@
const TreeChangeType = chrome.automation.TreeChangeType;
/**
- * ChromeVox2 live region handler.
+ * ChromeVox live region handler.
*/
export class LiveRegions {
/**