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="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> | 5 <include src="../../../../ui/webui/resources/js/cr/ui/focus_row.js"> |
6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> | 6 <include src="../../../../ui/webui/resources/js/cr/ui/focus_grid.js"> |
7 <include src="../uber/uber_utils.js"> | 7 <include src="../uber/uber_utils.js"> |
8 <include src="extension_code.js"> | 8 <include src="extension_code.js"> |
9 <include src="extension_commands_overlay.js"> | 9 <include src="extension_commands_overlay.js"> |
10 <include src="extension_error_overlay.js"> | 10 <include src="extension_error_overlay.js"> |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 profileInfo.appInfoDialogEnabled).then(function() { | 267 profileInfo.appInfoDialogEnabled).then(function() { |
268 // We can get called many times in short order, thus we need to | 268 // We can get called many times in short order, thus we need to |
269 // be careful to remove the 'finished loading' timeout. | 269 // be careful to remove the 'finished loading' timeout. |
270 if (this.loadingTimeout_) | 270 if (this.loadingTimeout_) |
271 window.clearTimeout(this.loadingTimeout_); | 271 window.clearTimeout(this.loadingTimeout_); |
272 document.documentElement.classList.add('loading'); | 272 document.documentElement.classList.add('loading'); |
273 this.loadingTimeout_ = window.setTimeout(function() { | 273 this.loadingTimeout_ = window.setTimeout(function() { |
274 document.documentElement.classList.remove('loading'); | 274 document.documentElement.classList.remove('loading'); |
275 }, 0); | 275 }, 0); |
276 | 276 |
277 /** @const */ | 277 extensionList.onExtensionCountChanged = |
278 var hasExtensions = extensionList.getNumExtensions() != 0; | 278 this.updateListVisibility_.bind(this); |
279 $('no-extensions').hidden = hasExtensions; | 279 this.updateListVisibility_(); |
Dan Beam
2015/04/27 16:17:05
why does the |this| matter at all for this method?
| |
280 $('extension-list-wrapper').hidden = !hasExtensions; | |
281 }.bind(this)); | 280 }.bind(this)); |
282 }, | 281 }, |
283 | 282 |
284 /** | 283 /** |
284 * Updates the visibility of the extension list and "Boo..." message. | |
285 * @private | |
286 */ | |
287 updateListVisibility_: function() { | |
Dan Beam
2015/04/27 16:17:05
make this static
Devlin
2015/04/27 18:28:30
Now, since this is a delegate method, I don't thin
Dan Beam
2015/04/27 18:47:59
fine as is
| |
288 /** @const */ | |
289 var hasExtensions = $('extension-settings-list').getNumExtensions() != 0; | |
290 $('no-extensions').hidden = hasExtensions; | |
291 $('extension-list-wrapper').hidden = !hasExtensions; | |
292 }, | |
293 | |
294 /** | |
285 * Handles the Pack Extension button. | 295 * Handles the Pack Extension button. |
286 * @param {Event} e Change event. | 296 * @param {Event} e Change event. |
287 * @private | 297 * @private |
288 */ | 298 */ |
289 handlePackExtension_: function(e) { | 299 handlePackExtension_: function(e) { |
290 ExtensionSettings.showOverlay($('pack-extension-overlay')); | 300 ExtensionSettings.showOverlay($('pack-extension-overlay')); |
291 chrome.send('metricsHandler:recordAction', ['Options_PackExtension']); | 301 chrome.send('metricsHandler:recordAction', ['Options_PackExtension']); |
292 }, | 302 }, |
293 | 303 |
294 /** | 304 /** |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 }; | 360 }; |
351 | 361 |
352 ExtensionSettings.onExtensionsChanged = function() { | 362 ExtensionSettings.onExtensionsChanged = function() { |
353 ExtensionSettings.getInstance().update_(); | 363 ExtensionSettings.getInstance().update_(); |
354 }; | 364 }; |
355 | 365 |
356 /** | 366 /** |
357 * Returns the current overlay or null if one does not exist. | 367 * Returns the current overlay or null if one does not exist. |
358 * @return {Element} The overlay element. | 368 * @return {Element} The overlay element. |
359 */ | 369 */ |
360 ExtensionSettings.getCurrentOverlay = function() { | 370 ExtensionSettings.getCurrentOverlay = function() { |
Dan Beam
2015/04/27 16:17:05
^ this is an example of a static method
| |
361 return document.querySelector('#overlay .page.showing'); | 371 return document.querySelector('#overlay .page.showing'); |
362 }; | 372 }; |
363 | 373 |
364 /** | 374 /** |
365 * Sets the given overlay to show. If the overlay is already showing, this is | 375 * Sets the given overlay to show. If the overlay is already showing, this is |
366 * a no-op; otherwise, hides any currently-showing overlay. | 376 * a no-op; otherwise, hides any currently-showing overlay. |
367 * @param {HTMLElement} node The overlay page to show. If null, all overlays | 377 * @param {HTMLElement} node The overlay page to show. If null, all overlays |
368 * are hidden. | 378 * are hidden. |
369 */ | 379 */ |
370 ExtensionSettings.showOverlay = function(node) { | 380 ExtensionSettings.showOverlay = function(node) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 // Export | 468 // Export |
459 return { | 469 return { |
460 ExtensionSettings: ExtensionSettings | 470 ExtensionSettings: ExtensionSettings |
461 }; | 471 }; |
462 }); | 472 }); |
463 | 473 |
464 window.addEventListener('load', function(e) { | 474 window.addEventListener('load', function(e) { |
465 document.documentElement.classList.add('loading'); | 475 document.documentElement.classList.add('loading'); |
466 extensions.ExtensionSettings.getInstance().initialize(); | 476 extensions.ExtensionSettings.getInstance().initialize(); |
467 }); | 477 }); |
OLD | NEW |