| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 trash.classList.add('open'); | 459 trash.classList.add('open'); |
| 460 trash.classList.toggle('mouse-clicked', e.detail > 0); | 460 trash.classList.toggle('mouse-clicked', e.detail > 0); |
| 461 if (this.uninstallIsShowing_) | 461 if (this.uninstallIsShowing_) |
| 462 return; | 462 return; |
| 463 this.uninstallIsShowing_ = true; | 463 this.uninstallIsShowing_ = true; |
| 464 chrome.management.uninstall(extension.id, | 464 chrome.management.uninstall(extension.id, |
| 465 {showConfirmDialog: true}, | 465 {showConfirmDialog: true}, |
| 466 function() { | 466 function() { |
| 467 // TODO(devlin): What should we do if the uninstall fails? | 467 // TODO(devlin): What should we do if the uninstall fails? |
| 468 this.uninstallIsShowing_ = false; | 468 this.uninstallIsShowing_ = false; |
| 469 |
| 470 if (trash.classList.contains('mouse-clicked')) |
| 471 trash.blur(); |
| 472 |
| 473 if (chrome.runtime.lastError) { |
| 474 // The uninstall failed (e.g. a cancel). Allow the trash to close. |
| 475 trash.classList.remove('open'); |
| 476 } else { |
| 477 // Leave the trash open if the uninstall succeded. Otherwise it can |
| 478 // half-close right before it's removed when the DOM is modified. |
| 479 } |
| 469 }.bind(this)); | 480 }.bind(this)); |
| 470 }.bind(this)); | 481 }.bind(this)); |
| 471 row.querySelector('.enable-controls').appendChild(trash); | 482 row.querySelector('.enable-controls').appendChild(trash); |
| 472 | 483 |
| 473 // Developer mode //////////////////////////////////////////////////////// | 484 // Developer mode //////////////////////////////////////////////////////// |
| 474 | 485 |
| 475 // The path, if provided by unpacked extension. | 486 // The path, if provided by unpacked extension. |
| 476 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', | 487 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', |
| 477 function(e) { | 488 function(e) { |
| 478 chrome.send('extensionSettingsShowPath', [String(extension.id)]); | 489 chrome.send('extensionSettingsShowPath', [String(extension.id)]); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 self.optionsShown_ = false; | 903 self.optionsShown_ = false; |
| 893 $('overlay').removeEventListener('cancelOverlay', f); | 904 $('overlay').removeEventListener('cancelOverlay', f); |
| 894 }); | 905 }); |
| 895 | 906 |
| 896 // TODO(dbeam): why do we need to focus <extensionoptions> before and | 907 // TODO(dbeam): why do we need to focus <extensionoptions> before and |
| 897 // after its showing animation? Makes very little sense to me. | 908 // after its showing animation? Makes very little sense to me. |
| 898 overlay.setInitialFocus(); | 909 overlay.setInitialFocus(); |
| 899 }, | 910 }, |
| 900 }; | 911 }; |
| 901 | 912 |
| 902 ExtensionList.uninstallCancel = function() { | |
| 903 var trash = document.querySelector('.trash.open'); | |
| 904 if (trash.classList.contains('mouse-clicked')) | |
| 905 trash.blur(); | |
| 906 trash.classList.remove('open'); | |
| 907 }; | |
| 908 | |
| 909 return { | 913 return { |
| 910 ExtensionList: ExtensionList | 914 ExtensionList: ExtensionList |
| 911 }; | 915 }; |
| 912 }); | 916 }); |
| OLD | NEW |