Commit 4081db2d authored by Katie D's avatar Katie D Committed by Commit Bot

Run google docs content script on Select-to-Speak load.

This allows Google Docs opened before Select-to-Speak was
enabled to still be read.

Bug: 882968
Change-Id: I723fcab46766983a8fe26477d2e9611e5bde1e9f
Reviewed-on: https://chromium-review.googlesource.com/1250601
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595553}
parent 999ba2f0
...@@ -101,6 +101,7 @@ let SelectToSpeak = function() { ...@@ -101,6 +101,7 @@ let SelectToSpeak = function() {
this.prefsManager_ = new PrefsManager(); this.prefsManager_ = new PrefsManager();
this.prefsManager_.initPreferences(); this.prefsManager_.initPreferences();
this.runContentScripts_();
this.setUpEventListeners_(); this.setUpEventListeners_();
}; };
...@@ -398,6 +399,31 @@ SelectToSpeak.prototype = { ...@@ -398,6 +399,31 @@ SelectToSpeak.prototype = {
[], this.prefsManager_.highlightColor()); [], this.prefsManager_.highlightColor());
}, },
/**
* Runs content scripts that allow Select-to-Speak access to
* Google Docs content without a11y mode enabled, in every open
* tab. Should be run when Select-to-Speak starts up so that any
* tabs already opened will be checked.
* This should be kept in sync with the "content_scripts" section in
* the Select-to-Speak manifest.
* @private
*/
runContentScripts_: function() {
chrome.tabs.query(
{
url: [
'https://docs.google.com/document*',
'https://docs.sandbox.google.com/*'
]
},
(tabs) => {
tabs.forEach((tab) => {
chrome.tabs.executeScript(
tab.id, {file: 'select_to_speak_gdocs_script.js'});
});
});
},
/** /**
* Set up event listeners user input. * Set up event listeners user input.
*/ */
......
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