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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 /** | 91 /** |
| 92 * Indicates whether an embedded options page that was navigated to through | 92 * Indicates whether an embedded options page that was navigated to through |
| 93 * the '?options=' URL query has been shown to the user. This is necessary | 93 * the '?options=' URL query has been shown to the user. This is necessary |
| 94 * to prevent showExtensionNodes_ from opening the options more than once. | 94 * to prevent showExtensionNodes_ from opening the options more than once. |
| 95 * @type {boolean} | 95 * @type {boolean} |
| 96 * @private | 96 * @private |
| 97 */ | 97 */ |
| 98 optionsShown_: false, | 98 optionsShown_: false, |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * Indicates whether an uninstall dialog is being shown to prevent multiple | |
| 102 * dialogs from being displayed. | |
| 103 * @type {boolean} | |
| 104 * @private | |
| 105 */ | |
| 106 uninstallShown_: false, | |
| 107 | |
| 108 /** | |
| 101 * Necessary to only show the butterbar once. | 109 * Necessary to only show the butterbar once. |
| 102 * @private {boolean} | 110 * @private {boolean} |
| 103 */ | 111 */ |
| 104 butterbarShown_: false, | 112 butterbarShown_: false, |
| 105 | 113 |
| 106 decorate: function() { | 114 decorate: function() { |
| 107 this.showExtensionNodes_(); | 115 this.showExtensionNodes_(); |
| 108 }, | 116 }, |
| 109 | 117 |
| 110 getIdQueryParam_: function() { | 118 getIdQueryParam_: function() { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 // disabled, because the user might e.g. get prompted when enabling | 289 // disabled, because the user might e.g. get prompted when enabling |
| 282 // and choose not to. | 290 // and choose not to. |
| 283 e.preventDefault(); | 291 e.preventDefault(); |
| 284 }); | 292 }); |
| 285 | 293 |
| 286 // 'Remove' button. | 294 // 'Remove' button. |
| 287 var trashTemplate = $('template-collection').querySelector('.trash'); | 295 var trashTemplate = $('template-collection').querySelector('.trash'); |
| 288 var trash = trashTemplate.cloneNode(true); | 296 var trash = trashTemplate.cloneNode(true); |
| 289 trash.title = loadTimeData.getString('extensionUninstall'); | 297 trash.title = loadTimeData.getString('extensionUninstall'); |
| 290 trash.addEventListener('click', function(e) { | 298 trash.addEventListener('click', function(e) { |
| 291 chrome.send('extensionSettingsUninstall', [extension.id]); | 299 if (this.uninstallShown_) |
| 292 }); | 300 return; |
| 301 this.uninstallShown_ = true; | |
|
not at google - send to devlin
2015/02/25 21:37:57
uninstallIsShowing would be better, Shown could me
Devlin
2015/02/25 23:12:47
Called it uninstallShown to match, e.g., optionsSh
not at google - send to devlin
2015/02/25 23:55:58
Should be optionsIsShowing :P
Devlin
2015/02/26 00:19:54
haha yeah, it should.
| |
| 302 // TODO(devlin): What should we do if the uninstall fails? | |
|
not at google - send to devlin
2015/02/25 21:37:57
TODO belongs in the callback body.
Devlin
2015/02/25 23:12:47
Done.
| |
| 303 chrome.management.uninstall(extension.id, | |
| 304 {showConfirmDialog: true}, | |
| 305 function() { | |
| 306 this.uninstallShown_ = false; | |
| 307 }.bind(this)); | |
| 308 }.bind(this)); | |
| 293 node.querySelector('.enable-controls').appendChild(trash); | 309 node.querySelector('.enable-controls').appendChild(trash); |
| 294 | 310 |
| 295 // Developer mode //////////////////////////////////////////////////////// | 311 // Developer mode //////////////////////////////////////////////////////// |
| 296 | 312 |
| 297 // The path, if provided by unpacked extension. | 313 // The path, if provided by unpacked extension. |
| 298 this.addListener_('click', node, '.load-path a:first-of-type', | 314 this.addListener_('click', node, '.load-path a:first-of-type', |
| 299 function(e) { | 315 function(e) { |
| 300 chrome.send('extensionSettingsShowPath', [String(extension.id)]); | 316 chrome.send('extensionSettingsShowPath', [String(extension.id)]); |
| 301 e.preventDefault(); | 317 e.preventDefault(); |
| 302 }); | 318 }); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 701 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 717 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 702 // after its showing animation? Makes very little sense to me. | 718 // after its showing animation? Makes very little sense to me. |
| 703 overlay.setInitialFocus(); | 719 overlay.setInitialFocus(); |
| 704 }, | 720 }, |
| 705 }; | 721 }; |
| 706 | 722 |
| 707 return { | 723 return { |
| 708 ExtensionsList: ExtensionsList | 724 ExtensionsList: ExtensionsList |
| 709 }; | 725 }; |
| 710 }); | 726 }); |
| OLD | NEW |