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

Side by Side Diff: chrome/browser/resources/extensions/extensions.js

Issue 512003002: Revert of Revert "Typecheck JS files for chrome://extensions" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="../uber/uber_utils.js"> 5 <include src="../uber/uber_utils.js">
6 <include src="extension_code.js"> 6 <include src="extension_code.js">
7 <include src="extension_commands_overlay.js"> 7 <include src="extension_commands_overlay.js">
8 <include src="extension_error_overlay.js">
8 <include src="extension_focus_manager.js"> 9 <include src="extension_focus_manager.js">
9 <include src="extension_list.js"> 10 <include src="extension_list.js">
10 <include src="pack_extension_overlay.js"> 11 <include src="pack_extension_overlay.js">
11 <include src="extension_error_overlay.js">
12 <include src="extension_loader.js"> 12 <include src="extension_loader.js">
13 <include src="extension_options_overlay.js"> 13 <include src="extension_options_overlay.js">
14 14
15 <if expr="chromeos"> 15 <if expr="chromeos">
16 <include src="chromeos/kiosk_apps.js"> 16 <include src="chromeos/kiosk_apps.js">
17 </if> 17 </if>
18 18
19 /**
20 * The type of the extension data object. The definition is based on
21 * chrome/browser/ui/webui/extensions/extension_settings_handler.cc:
22 * ExtensionSettingsHandler::HandleRequestExtensionsData()
23 * @typedef {{developerMode: boolean,
24 * extensions: Array,
25 * incognitoAvailable: boolean,
26 * loadUnpackedDisabled: boolean,
27 * profileIsSupervised: boolean,
28 * promoteAppsDevTools: boolean}}
29 */
30 var ExtensionDataResponse;
31
19 // Used for observing function of the backend datasource for this page by 32 // Used for observing function of the backend datasource for this page by
20 // tests. 33 // tests.
21 var webuiResponded = false; 34 var webuiResponded = false;
22 35
23 cr.define('extensions', function() { 36 cr.define('extensions', function() {
24 var ExtensionsList = options.ExtensionsList; 37 var ExtensionsList = options.ExtensionsList;
25 38
26 // Implements the DragWrapper handler interface. 39 // Implements the DragWrapper handler interface.
27 var dragWrapperHandler = { 40 var dragWrapperHandler = {
28 /** @override */ 41 /** @override */
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 */ 265 */
253 handleToggleDevMode_: function(e) { 266 handleToggleDevMode_: function(e) {
254 if ($('toggle-dev-on').checked) { 267 if ($('toggle-dev-on').checked) {
255 $('dev-controls').hidden = false; 268 $('dev-controls').hidden = false;
256 window.setTimeout(function() { 269 window.setTimeout(function() {
257 $('extension-settings').classList.add('dev-mode'); 270 $('extension-settings').classList.add('dev-mode');
258 }, 0); 271 }, 0);
259 } else { 272 } else {
260 $('extension-settings').classList.remove('dev-mode'); 273 $('extension-settings').classList.remove('dev-mode');
261 } 274 }
262 window.setTimeout(this.updatePromoVisibility_.bind(this)); 275 window.setTimeout(this.updatePromoVisibility_.bind(this), 0);
263 276
264 chrome.send('extensionSettingsToggleDeveloperMode'); 277 chrome.send('extensionSettingsToggleDeveloperMode');
265 }, 278 },
266 279
267 /** 280 /**
268 * Called when a transition has ended for #dev-controls. 281 * Called when a transition has ended for #dev-controls.
269 * @param {Event} e webkitTransitionEnd event. 282 * @param {Event} e webkitTransitionEnd event.
270 * @private 283 * @private
271 */ 284 */
272 handleDevControlsTransitionEnd_: function(e) { 285 handleDevControlsTransitionEnd_: function(e) {
273 if (e.propertyName == 'height' && 286 if (e.propertyName == 'height' &&
274 !$('extension-settings').classList.contains('dev-mode')) { 287 !$('extension-settings').classList.contains('dev-mode')) {
275 $('dev-controls').hidden = true; 288 $('dev-controls').hidden = true;
276 } 289 }
277 }, 290 },
278 }; 291 };
279 292
280 /** 293 /**
281 * Called by the dom_ui_ to re-populate the page with data representing 294 * Called by the dom_ui_ to re-populate the page with data representing
282 * the current state of installed extensions. 295 * the current state of installed extensions.
296 * @param {ExtensionDataResponse} extensionsData
283 */ 297 */
284 ExtensionSettings.returnExtensionsData = function(extensionsData) { 298 ExtensionSettings.returnExtensionsData = function(extensionsData) {
285 // We can get called many times in short order, thus we need to 299 // We can get called many times in short order, thus we need to
286 // be careful to remove the 'finished loading' timeout. 300 // be careful to remove the 'finished loading' timeout.
287 if (this.loadingTimeout_) 301 if (this.loadingTimeout_)
288 window.clearTimeout(this.loadingTimeout_); 302 window.clearTimeout(this.loadingTimeout_);
289 document.documentElement.classList.add('loading'); 303 document.documentElement.classList.add('loading');
290 this.loadingTimeout_ = window.setTimeout(function() { 304 this.loadingTimeout_ = window.setTimeout(function() {
291 document.documentElement.classList.remove('loading'); 305 document.documentElement.classList.remove('loading');
292 }, 0); 306 }, 0);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 currentlyShowingOverlay.classList.remove('showing'); 410 currentlyShowingOverlay.classList.remove('showing');
397 411
398 if (node) 412 if (node)
399 node.classList.add('showing'); 413 node.classList.add('showing');
400 414
401 var pages = document.querySelectorAll('.page'); 415 var pages = document.querySelectorAll('.page');
402 for (var i = 0; i < pages.length; i++) { 416 for (var i = 0; i < pages.length; i++) {
403 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false'); 417 pages[i].setAttribute('aria-hidden', node ? 'true' : 'false');
404 } 418 }
405 419
406 overlay.hidden = !node; 420 $('overlay').hidden = !node;
407 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' : 421 uber.invokeMethodOnParent(node ? 'beginInterceptingEvents' :
408 'stopInterceptingEvents'); 422 'stopInterceptingEvents');
409 }; 423 };
410 424
411 /** 425 /**
412 * Utility function to find the width of various UI strings and synchronize 426 * Utility function to find the width of various UI strings and synchronize
413 * the width of relevant spans. This is crucial for making sure the 427 * the width of relevant spans. This is crucial for making sure the
414 * Enable/Enabled checkboxes align, as well as the Developer Mode checkbox. 428 * Enable/Enabled checkboxes align, as well as the Developer Mode checkbox.
415 */ 429 */
416 function measureCheckboxStrings() { 430 function measureCheckboxStrings() {
(...skipping 23 matching lines...) Expand all
440 454
441 // Export 455 // Export
442 return { 456 return {
443 ExtensionSettings: ExtensionSettings 457 ExtensionSettings: ExtensionSettings
444 }; 458 };
445 }); 459 });
446 460
447 window.addEventListener('load', function(e) { 461 window.addEventListener('load', function(e) {
448 extensions.ExtensionSettings.getInstance().initialize(); 462 extensions.ExtensionSettings.getInstance().initialize();
449 }); 463 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698