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

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

Issue 508283002: 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="extension_error.js"> 5 <include src="extension_error.js">
6 6
7 /**
8 * The type of the extension data object. The definition is based on
9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc
10 * and
11 * chrome/browser/ui/webui/extensions/extension_settings_handler.cc
12 * ExtensionSettingsHandler::CreateExtensionDetailValue()
13 * @typedef {{allow_reload: boolean,
14 * allowAllUrls: boolean,
15 * allowFileAccess: boolean,
16 * blacklistText: string,
17 * corruptInstall: boolean,
18 * dependentExtensions: Array,
19 * description: string,
20 * detailsUrl: string,
21 * enable_show_button: boolean,
22 * enabled: boolean,
23 * enabledIncognito: boolean,
24 * errorCollectionEnabled: (boolean|undefined),
25 * hasPopupAction: boolean,
26 * homepageProvided: boolean,
27 * homepageUrl: string,
28 * icon: string,
29 * id: string,
30 * incognitoCanBeEnabled: boolean,
31 * installWarnings: (Array|undefined),
32 * is_hosted_app: boolean,
33 * is_platform_app: boolean,
34 * isUnpacked: boolean,
35 * kioskEnabled: boolean,
36 * kioskOnly: boolean,
37 * locationText: string,
38 * managedInstall: boolean,
39 * manifestErrors: (Array.<RuntimeError>|undefined),
40 * name: string,
41 * offlineEnabled: boolean,
42 * optionsUrl: string,
43 * order: number,
44 * packagedApp: boolean,
45 * path: (string|undefined),
46 * prettifiedPath: (string|undefined),
47 * runtimeErrors: (Array.<RuntimeError>|undefined),
48 * suspiciousInstall: boolean,
49 * terminated: boolean,
50 * version: string,
51 * views: Array.<{renderViewId: number, renderProcessId: number,
52 * path: string, incognito: boolean,
53 * generatedBackgroundPage: boolean}>,
54 * wantsAllUrls: boolean,
55 * wantsErrorCollection: boolean,
56 * wantsFileAccess: boolean,
57 * warnings: (Array|undefined)}}
58 */
59 var ExtensionData;
60
61 cr.define('options', function() { 7 cr.define('options', function() {
62 'use strict'; 8 'use strict';
63 9
64 /** 10 /**
65 * Creates a new list of extensions. 11 * Creates a new list of extensions.
66 * @param {Object=} opt_propertyBag Optional properties. 12 * @param {Object=} opt_propertyBag Optional properties.
67 * @constructor 13 * @constructor
68 * @extends {HTMLDivElement} 14 * @extends {cr.ui.div}
69 */ 15 */
70 var ExtensionsList = cr.ui.define('div'); 16 var ExtensionsList = cr.ui.define('div');
71 17
72 /** 18 /**
73 * @type {Object.<string, boolean>} A map from extension id to a boolean 19 * @type {Object.<string, boolean>} A map from extension id to a boolean
74 * indicating whether the incognito warning is showing. This persists 20 * indicating whether the incognito warning is showing. This persists
75 * between calls to decorate. 21 * between calls to decorate.
76 */ 22 */
77 var butterBarVisibility = {}; 23 var butterBarVisibility = {};
78 24
79 /** 25 /**
80 * @type {Object.<string, number>} A map from extension id to last reloaded 26 * @type {Object.<string, string>} A map from extension id to last reloaded
81 * timestamp. The timestamp is recorded when the user click the 'Reload' 27 * timestamp. The timestamp is recorded when the user click the 'Reload'
82 * link. It is used to refresh the icon of an unpacked extension. 28 * link. It is used to refresh the icon of an unpacked extension.
83 * This persists between calls to decorate. 29 * This persists between calls to decorate.
84 */ 30 */
85 var extensionReloadedTimestamp = {}; 31 var extensionReloadedTimestamp = {};
86 32
87 ExtensionsList.prototype = { 33 ExtensionsList.prototype = {
88 __proto__: HTMLDivElement.prototype, 34 __proto__: HTMLDivElement.prototype,
89 35
90 /** 36 /**
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // above the element being scrolled to. 91 // above the element being scrolled to.
146 var scrollFudge = 1.2; 92 var scrollFudge = 1.2;
147 var scrollTop = $(extensionId).offsetTop - scrollFudge * 93 var scrollTop = $(extensionId).offsetTop - scrollFudge *
148 $(extensionId).clientHeight; 94 $(extensionId).clientHeight;
149 setScrollTopForDocument(document, scrollTop); 95 setScrollTopForDocument(document, scrollTop);
150 }, 96 },
151 97
152 /** 98 /**
153 * Synthesizes and initializes an HTML element for the extension metadata 99 * Synthesizes and initializes an HTML element for the extension metadata
154 * given in |extension|. 100 * given in |extension|.
155 * @param {ExtensionData} extension A dictionary of extension metadata. 101 * @param {Object} extension A dictionary of extension metadata.
156 * @private 102 * @private
157 */ 103 */
158 createNode_: function(extension) { 104 createNode_: function(extension) {
159 var template = $('template-collection').querySelector( 105 var template = $('template-collection').querySelector(
160 '.extension-list-item-wrapper'); 106 '.extension-list-item-wrapper');
161 var node = template.cloneNode(true); 107 var node = template.cloneNode(true);
162 node.id = extension.id; 108 node.id = extension.id;
163 109
164 if (!extension.enabled || extension.terminated) 110 if (!extension.enabled || extension.terminated)
165 node.classList.add('inactive-extension'); 111 node.classList.add('inactive-extension');
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 li.innerText = warning.message; 426 li.innerText = warning.message;
481 list.appendChild(li); 427 list.appendChild(li);
482 }); 428 });
483 } 429 }
484 430
485 this.appendChild(node); 431 this.appendChild(node);
486 if (location.hash.substr(1) == extension.id) { 432 if (location.hash.substr(1) == extension.id) {
487 // Scroll beneath the fixed header so that the extension is not 433 // Scroll beneath the fixed header so that the extension is not
488 // obscured. 434 // obscured.
489 var topScroll = node.offsetTop - $('page-header').offsetHeight; 435 var topScroll = node.offsetTop - $('page-header').offsetHeight;
490 var pad = parseInt(window.getComputedStyle(node, null).marginTop, 10); 436 var pad = parseInt(getComputedStyle(node, null).marginTop, 10);
491 if (!isNaN(pad)) 437 if (!isNaN(pad))
492 topScroll -= pad / 2; 438 topScroll -= pad / 2;
493 setScrollTopForDocument(document, topScroll); 439 setScrollTopForDocument(document, topScroll);
494 } 440 }
495 }, 441 },
496 442
497 /** 443 /**
498 * Opens the extension options overlay for the extension with the given id. 444 * Opens the extension options overlay for the extension with the given id.
499 * @param {string} extensionId The id of extension whose options page should 445 * @param {string} extensionId The id of extension whose options page should
500 * be displayed. 446 * be displayed.
(...skipping 28 matching lines...) Expand all
529 $('overlay').addEventListener('cancelOverlay', function() { 475 $('overlay').addEventListener('cancelOverlay', function() {
530 this.optionsShown_ = false; 476 this.optionsShown_ = false;
531 }.bind(this)); 477 }.bind(this));
532 }, 478 },
533 }; 479 };
534 480
535 return { 481 return {
536 ExtensionsList: ExtensionsList 482 ExtensionsList: ExtensionsList
537 }; 483 };
538 }); 484 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698