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