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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/closure/closure_preinit.js

Issue 2943193002: Run clang-format on .js files in c/b/r/chromeos/chromevox (Closed)
Patch Set: Created 3 years, 6 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
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 Code to execute before Closure's base.js. 6 * @fileoverview Code to execute before Closure's base.js.
7 * 7 *
8 */ 8 */
9 9
10 /** 10 /**
(...skipping 18 matching lines...) Expand all
29 /** 29 /**
30 * Custom function for importing ChromeVox scripts. 30 * Custom function for importing ChromeVox scripts.
31 * @param {string} src The JS file to import. 31 * @param {string} src The JS file to import.
32 * @return {boolean} Whether the script was imported. 32 * @return {boolean} Whether the script was imported.
33 */ 33 */
34 window.CLOSURE_IMPORT_SCRIPT = function(src) { 34 window.CLOSURE_IMPORT_SCRIPT = function(src) {
35 // Only run our version of the import script 35 // Only run our version of the import script
36 // when trying to inject ChromeVox scripts. 36 // when trying to inject ChromeVox scripts.
37 // TODO(lazyboy): Use URL instead. 37 // TODO(lazyboy): Use URL instead.
38 if (src.startsWith('chrome-extension://')) { 38 if (src.startsWith('chrome-extension://')) {
39 if (!goog.inHtmlDocument_() || 39 if (!goog.inHtmlDocument_() || goog.dependencies_.written[src]) {
40 goog.dependencies_.written[src]) {
41 return false; 40 return false;
42 } 41 }
43 goog.dependencies_.written[src] = true; 42 goog.dependencies_.written[src] = true;
44 function loadNextScript() { 43 function loadNextScript() {
45 if (goog.global.queue_.length == 0) 44 if (goog.global.queue_.length == 0)
46 return; 45 return;
47 46
48 var src = goog.global.queue_[0]; 47 var src = goog.global.queue_[0];
49 48
50 if (window.CLOSURE_USE_EXT_MESSAGES) { 49 if (window.CLOSURE_USE_EXT_MESSAGES) {
51 var relativeSrc = src.substr(src.indexOf('closure/..') + 11); 50 var relativeSrc = src.substr(src.indexOf('closure/..') + 11);
52 chrome.extension.sendMessage( 51 chrome.extension.sendMessage(
53 {'srcFile': relativeSrc}, 52 {'srcFile': relativeSrc}, function(response) {
54 function(response) {
55 try { 53 try {
56 eval(response['code']); 54 eval(response['code']);
57 } catch (e) { 55 } catch (e) {
58 console.error('Script error: ' + e + ' in ' + src); 56 console.error('Script error: ' + e + ' in ' + src);
59 } 57 }
60 goog.global.queue_ = goog.global.queue_.slice(1); 58 goog.global.queue_ = goog.global.queue_.slice(1);
61 loadNextScript(); 59 loadNextScript();
62 }); 60 });
63 return; 61 return;
64 } 62 }
(...skipping 21 matching lines...) Expand all
86 } 84 }
87 goog.global.queue_.push(src); 85 goog.global.queue_.push(src);
88 if (goog.global.queue_.length == 1) { 86 if (goog.global.queue_.length == 1) {
89 loadNextScript(); 87 loadNextScript();
90 } 88 }
91 return true; 89 return true;
92 } else { 90 } else {
93 return goog.writeScriptTag_(src); 91 return goog.writeScriptTag_(src);
94 } 92 }
95 }; 93 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698