Chromium Code Reviews| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 trash.classList.add('open'); | 460 trash.classList.add('open'); |
| 453 trash.classList.toggle('mouse-clicked', e.detail > 0); | 461 trash.classList.toggle('mouse-clicked', e.detail > 0); |
| 454 chrome.send('extensionSettingsUninstall', [extension.id]); | 462 if (this.uninstallIsShowing_) |
| 455 }); | 463 return; |
| 464 this.uninstallIsShowing_ = true; | |
| 465 chrome.management.uninstall(extension.id, | |
| 466 {showConfirmDialog: true}, | |
| 467 function() { | |
| 468 // TODO(devlin): What should we do if the uninstall fails? | |
| 469 this.uninstallIsShowing_ = false; | |
| 470 }.bind(this)); | |
| 471 }.bind(this)); | |
| 456 row.querySelector('.enable-controls').appendChild(trash); | 472 row.querySelector('.enable-controls').appendChild(trash); |
| 457 | 473 |
| 458 // Developer mode //////////////////////////////////////////////////////// | 474 // Developer mode //////////////////////////////////////////////////////// |
| 459 | 475 |
| 460 // The path, if provided by unpacked extension. | 476 // The path, if provided by unpacked extension. |
| 461 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', | 477 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', |
| 462 function(e) { | 478 function(e) { |
| 463 chrome.send('extensionSettingsShowPath', [String(extension.id)]); | 479 chrome.send('extensionSettingsShowPath', [String(extension.id)]); |
| 464 e.preventDefault(); | 480 e.preventDefault(); |
| 465 }); | 481 }); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 self.optionsShown_ = false; | 893 self.optionsShown_ = false; |
| 878 $('overlay').removeEventListener('cancelOverlay', f); | 894 $('overlay').removeEventListener('cancelOverlay', f); |
| 879 }); | 895 }); |
| 880 | 896 |
| 881 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 897 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 882 // after its showing animation? Makes very little sense to me. | 898 // after its showing animation? Makes very little sense to me. |
| 883 overlay.setInitialFocus(); | 899 overlay.setInitialFocus(); |
| 884 }, | 900 }, |
| 885 }; | 901 }; |
| 886 | 902 |
| 887 ExtensionList.uninstallCancel = function() { | 903 ExtensionList.uninstallCancel = function() { |
|
Dan Beam
2015/03/03 00:12:59
dead code now :(
| |
| 888 var trash = document.querySelector('.trash.open'); | 904 var trash = document.querySelector('.trash.open'); |
| 889 if (trash.classList.contains('mouse-clicked')) | 905 if (trash.classList.contains('mouse-clicked')) |
| 890 trash.blur(); | 906 trash.blur(); |
| 891 trash.classList.remove('open'); | 907 trash.classList.remove('open'); |
| 892 }; | 908 }; |
| 893 | 909 |
| 894 return { | 910 return { |
| 895 ExtensionList: ExtensionList | 911 ExtensionList: ExtensionList |
| 896 }; | 912 }; |
| 897 }); | 913 }); |
| OLD | NEW |