| 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="extension_error.js"> | 5 <include src="extension_error.js"> |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The type of the extension data object. The definition is based on | 8 * The type of the extension data object. The definition is based on |
| 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc | 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc |
| 10 * and | 10 * and |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * version: string, | 58 * version: string, |
| 59 * views: Array<{renderViewId: number, renderProcessId: number, | 59 * views: Array<{renderViewId: number, renderProcessId: number, |
| 60 * path: string, incognito: boolean, | 60 * path: string, incognito: boolean, |
| 61 * generatedBackgroundPage: boolean}>, | 61 * generatedBackgroundPage: boolean}>, |
| 62 * wantsErrorCollection: boolean, | 62 * wantsErrorCollection: boolean, |
| 63 * wantsFileAccess: boolean, | 63 * wantsFileAccess: boolean, |
| 64 * warnings: (Array|undefined)}} | 64 * warnings: (Array|undefined)}} |
| 65 */ | 65 */ |
| 66 var ExtensionData; | 66 var ExtensionData; |
| 67 | 67 |
| 68 cr.define('options', function() { | 68 cr.define('extensions', function() { |
| 69 'use strict'; | 69 'use strict'; |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Creates a new list of extensions. | 72 * Creates a new list of extensions. |
| 73 * @param {Object=} opt_propertyBag Optional properties. | 73 * @param {Object=} opt_propertyBag Optional properties. |
| 74 * @constructor | 74 * @constructor |
| 75 * @extends {HTMLDivElement} | 75 * @extends {HTMLDivElement} |
| 76 */ | 76 */ |
| 77 var ExtensionsList = cr.ui.define('div'); | 77 var ExtensionList = cr.ui.define('div'); |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * @type {Object<string, number>} A map from extension id to last reloaded | 80 * @type {Object<string, number>} A map from extension id to last reloaded |
| 81 * timestamp. The timestamp is recorded when the user click the 'Reload' | 81 * timestamp. The timestamp is recorded when the user click the 'Reload' |
| 82 * link. It is used to refresh the icon of an unpacked extension. | 82 * link. It is used to refresh the icon of an unpacked extension. |
| 83 * This persists between calls to decorate. | 83 * This persists between calls to decorate. |
| 84 */ | 84 */ |
| 85 var extensionReloadedTimestamp = {}; | 85 var extensionReloadedTimestamp = {}; |
| 86 | 86 |
| 87 ExtensionsList.prototype = { | 87 ExtensionList.prototype = { |
| 88 __proto__: HTMLDivElement.prototype, | 88 __proto__: HTMLDivElement.prototype, |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Indicates whether an embedded options page that was navigated to through | 91 * Indicates whether an embedded options page that was navigated to through |
| 92 * the '?options=' URL query has been shown to the user. This is necessary | 92 * the '?options=' URL query has been shown to the user. This is necessary |
| 93 * to prevent showExtensionNodes_ from opening the options more than once. | 93 * to prevent showExtensionNodes_ from opening the options more than once. |
| 94 * @type {boolean} | 94 * @type {boolean} |
| 95 * @private | 95 * @private |
| 96 */ | 96 */ |
| 97 optionsShown_: false, | 97 optionsShown_: false, |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // disabled, because the user might e.g. get prompted when enabling | 279 // disabled, because the user might e.g. get prompted when enabling |
| 280 // and choose not to. | 280 // and choose not to. |
| 281 e.preventDefault(); | 281 e.preventDefault(); |
| 282 }); | 282 }); |
| 283 | 283 |
| 284 // 'Remove' button. | 284 // 'Remove' button. |
| 285 var trashTemplate = $('template-collection').querySelector('.trash'); | 285 var trashTemplate = $('template-collection').querySelector('.trash'); |
| 286 var trash = trashTemplate.cloneNode(true); | 286 var trash = trashTemplate.cloneNode(true); |
| 287 trash.title = loadTimeData.getString('extensionUninstall'); | 287 trash.title = loadTimeData.getString('extensionUninstall'); |
| 288 trash.addEventListener('click', function(e) { | 288 trash.addEventListener('click', function(e) { |
| 289 trash.classList.add('open'); |
| 289 chrome.send('extensionSettingsUninstall', [extension.id]); | 290 chrome.send('extensionSettingsUninstall', [extension.id]); |
| 290 }); | 291 }); |
| 291 node.querySelector('.enable-controls').appendChild(trash); | 292 node.querySelector('.enable-controls').appendChild(trash); |
| 292 | 293 |
| 293 // Developer mode //////////////////////////////////////////////////////// | 294 // Developer mode //////////////////////////////////////////////////////// |
| 294 | 295 |
| 295 // The path, if provided by unpacked extension. | 296 // The path, if provided by unpacked extension. |
| 296 this.addListener_('click', node, '.load-path a:first-of-type', | 297 this.addListener_('click', node, '.load-path a:first-of-type', |
| 297 function(e) { | 298 function(e) { |
| 298 chrome.send('extensionSettingsShowPath', [String(extension.id)]); | 299 chrome.send('extensionSettingsShowPath', [String(extension.id)]); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 self.optionsShown_ = false; | 695 self.optionsShown_ = false; |
| 695 $('overlay').removeEventListener('cancelOverlay', f); | 696 $('overlay').removeEventListener('cancelOverlay', f); |
| 696 }); | 697 }); |
| 697 | 698 |
| 698 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 699 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 699 // after its showing animation? Makes very little sense to me. | 700 // after its showing animation? Makes very little sense to me. |
| 700 overlay.setInitialFocus(); | 701 overlay.setInitialFocus(); |
| 701 }, | 702 }, |
| 702 }; | 703 }; |
| 703 | 704 |
| 705 ExtensionList.uninstallCancel = function() { |
| 706 document.querySelector('.trash.open').classList.remove('open'); |
| 707 }; |
| 708 |
| 704 return { | 709 return { |
| 705 ExtensionsList: ExtensionsList | 710 ExtensionList: ExtensionList |
| 706 }; | 711 }; |
| 707 }); | 712 }); |
| OLD | NEW |