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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/chromevox/injected/init_document.js

Issue 1592513002: Use a predicate that isn't so granular during continuous read. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/background.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 Initializes the injected content script on the document. 6 * @fileoverview Initializes the injected content script on the document.
7 * 7 *
8 * NOTE(deboer): This file will automatically initialize ChromeVox. If you can 8 * NOTE(deboer): This file will automatically initialize ChromeVox. If you can
9 * control when ChromeVox starts, consider using cvox.InitGlobals instead. 9 * control when ChromeVox starts, consider using cvox.InitGlobals instead.
10 * 10 *
(...skipping 27 matching lines...) Expand all
38 * Maximum retry timeout for initialization. Note that exponential backoff 38 * Maximum retry timeout for initialization. Note that exponential backoff
39 * used, so the actual time before giving up is about twice this number. 39 * used, so the actual time before giving up is about twice this number.
40 * @const {number} 40 * @const {number}
41 * @private 41 * @private
42 */ 42 */
43 cvox.ChromeVox.MAX_INIT_TIMEOUT_ = 30000; 43 cvox.ChromeVox.MAX_INIT_TIMEOUT_ = 30000;
44 44
45 45
46 /** 46 /**
47 * Flag indicating if ChromeVox Classic is enabled based on the Next 47 * Flag indicating if ChromeVox Classic is enabled based on the Next
48 * background page. Initializes to true for non-top level 48 * background page which sends the state at page load.
49 * (i.e. iframes) windows. For top level windows, left undefined and
50 * set when background page replies.
51 * @type {boolean|undefined} 49 * @type {boolean|undefined}
52 * @private 50 * @private
53 */ 51 */
54 cvox.ChromeVox.isClassicEnabled_ = window.top == window ? undefined : true; 52 cvox.ChromeVox.isClassicEnabled_ = undefined;
dmazzoni 2016/01/20 06:31:05 Is this from a different patch?
55 53
56 54
57 /** 55 /**
58 * Call the init function later, safely. 56 * Call the init function later, safely.
59 * @param {string} reason A developer-readable string to log to the console 57 * @param {string} reason A developer-readable string to log to the console
60 * explaining why we're trying again. 58 * explaining why we're trying again.
61 * @private 59 * @private
62 */ 60 */
63 cvox.ChromeVox.recallInit_ = function(reason) { 61 cvox.ChromeVox.recallInit_ = function(reason) {
64 if (cvox.ChromeVox.initTimeout_ > cvox.ChromeVox.MAX_INIT_TIMEOUT_) { 62 if (cvox.ChromeVox.initTimeout_ > cvox.ChromeVox.MAX_INIT_TIMEOUT_) {
65 window.console.log(reason + 63 if (cvox.ChromeVox.isClassicEnabled_ !== undefined) {
66 ' Taking too long - giving up.'); 64 window.console.log(reason +
67 return; 65 ' Taking too long - giving up.');
66 return;
67 } else {
68 // Default to enabling classic after the timeout.
69 cvox.ChromeVox.isClassicEnabled_ = true;
70 }
68 } 71 }
69 window.console.log(reason + 72 window.console.log(reason +
70 ' Will try again in ' + 73 ' Will try again in ' +
71 cvox.ChromeVox.initTimeout_ + 'ms'); 74 cvox.ChromeVox.initTimeout_ + 'ms');
72 cvox.ChromeVox.initTimer_ = window.setTimeout( 75 cvox.ChromeVox.initTimer_ = window.setTimeout(
73 cvox.ChromeVox.initDocument, 76 cvox.ChromeVox.initDocument,
74 cvox.ChromeVox.initTimeout_); 77 cvox.ChromeVox.initTimeout_);
75 cvox.ChromeVox.initTimeout_ *= 2; 78 cvox.ChromeVox.initTimeout_ *= 2;
76 }; 79 };
77 80
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 cvox.ChromeVox.isClassicEnabled_ = msg['isClassicEnabled']; 159 cvox.ChromeVox.isClassicEnabled_ = msg['isClassicEnabled'];
157 } 160 }
158 }); 161 });
159 162
160 cvox.ExtensionBridge.addDisconnectListener(function() { 163 cvox.ExtensionBridge.addDisconnectListener(function() {
161 if (cvox.ChromeVox.initTimer_ > 0) { 164 if (cvox.ChromeVox.initTimer_ > 0) {
162 window.clearTimeout(cvox.ChromeVox.initTimer_); 165 window.clearTimeout(cvox.ChromeVox.initTimer_);
163 cvox.ChromeVox.initTimer_ = 0; 166 cvox.ChromeVox.initTimer_ = 0;
164 } 167 }
165 }); 168 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698