| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 * to prevent showExtensionNodes_ from opening the options more than once. | 225 * to prevent showExtensionNodes_ from opening the options more than once. |
| 226 * @type {boolean} | 226 * @type {boolean} |
| 227 * @private | 227 * @private |
| 228 */ | 228 */ |
| 229 optionsShown_: false, | 229 optionsShown_: false, |
| 230 | 230 |
| 231 /** @private {!cr.ui.FocusGrid} */ | 231 /** @private {!cr.ui.FocusGrid} */ |
| 232 focusGrid_: new cr.ui.FocusGrid(), | 232 focusGrid_: new cr.ui.FocusGrid(), |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * Indicates whether an uninstall dialog is being shown to prevent multiple |
| 236 * dialogs from being displayed. |
| 237 * @type {boolean} |
| 238 * @private |
| 239 */ |
| 240 uninstallIsShowing_: false, |
| 241 |
| 242 /** |
| 235 * Necessary to only show the butterbar once. | 243 * Necessary to only show the butterbar once. |
| 236 * @private {boolean} | 244 * @private {boolean} |
| 237 */ | 245 */ |
| 238 butterbarShown_: false, | 246 butterbarShown_: false, |
| 239 | 247 |
| 240 decorate: function() { | 248 decorate: function() { |
| 241 this.showExtensionNodes_(); | 249 this.showExtensionNodes_(); |
| 242 }, | 250 }, |
| 243 | 251 |
| 244 getIdQueryParam_: function() { | 252 getIdQueryParam_: function() { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 e.preventDefault(); | 450 e.preventDefault(); |
| 443 }); | 451 }); |
| 444 | 452 |
| 445 // 'Remove' button. | 453 // 'Remove' button. |
| 446 var trashTemplate = $('template-collection').querySelector('.trash'); | 454 var trashTemplate = $('template-collection').querySelector('.trash'); |
| 447 var trash = trashTemplate.cloneNode(true); | 455 var trash = trashTemplate.cloneNode(true); |
| 448 trash.title = loadTimeData.getString('extensionUninstall'); | 456 trash.title = loadTimeData.getString('extensionUninstall'); |
| 449 trash.hidden = extension.managedInstall; | 457 trash.hidden = extension.managedInstall; |
| 450 trash.setAttribute('column-type', 'trash'); | 458 trash.setAttribute('column-type', 'trash'); |
| 451 trash.addEventListener('click', function(e) { | 459 trash.addEventListener('click', function(e) { |
| 452 chrome.send('extensionSettingsUninstall', [extension.id]); | 460 if (this.uninstallIsShowing_) |
| 453 }); | 461 return; |
| 462 this.uninstallIsShowing_ = true; |
| 463 chrome.management.uninstall(extension.id, |
| 464 {showConfirmDialog: true}, |
| 465 function() { |
| 466 // TODO(devlin): What should we do if the uninstall fails? |
| 467 this.uninstallIsShowing_ = false; |
| 468 }.bind(this)); |
| 469 }.bind(this)); |
| 454 row.querySelector('.enable-controls').appendChild(trash); | 470 row.querySelector('.enable-controls').appendChild(trash); |
| 455 | 471 |
| 456 // Developer mode //////////////////////////////////////////////////////// | 472 // Developer mode //////////////////////////////////////////////////////// |
| 457 | 473 |
| 458 // The path, if provided by unpacked extension. | 474 // The path, if provided by unpacked extension. |
| 459 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', | 475 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', |
| 460 function(e) { | 476 function(e) { |
| 461 chrome.send('extensionSettingsShowPath', [String(extension.id)]); | 477 chrome.send('extensionSettingsShowPath', [String(extension.id)]); |
| 462 e.preventDefault(); | 478 e.preventDefault(); |
| 463 }); | 479 }); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 895 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 880 // after its showing animation? Makes very little sense to me. | 896 // after its showing animation? Makes very little sense to me. |
| 881 overlay.setInitialFocus(); | 897 overlay.setInitialFocus(); |
| 882 }, | 898 }, |
| 883 }; | 899 }; |
| 884 | 900 |
| 885 return { | 901 return { |
| 886 ExtensionsList: ExtensionsList | 902 ExtensionsList: ExtensionsList |
| 887 }; | 903 }; |
| 888 }); | 904 }); |
| OLD | NEW |