diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 22:04:28 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 22:04:28 +0000 |
commit | 121cd7b957d4ed22f861a22783de788703bcaf7c (patch) | |
tree | c8a391f2c463a0321b7cb2efd61f9760fca51249 /chrome/browser/dom_ui/app_launcher_handler.cc | |
parent | a850ba49a28734c8660e04c52449a3b770a04d1b (diff) | |
download | chromium_src-121cd7b957d4ed22f861a22783de788703bcaf7c.zip chromium_src-121cd7b957d4ed22f861a22783de788703bcaf7c.tar.gz chromium_src-121cd7b957d4ed22f861a22783de788703bcaf7c.tar.bz2 |
Add a confirmation prompt to app uninstallation on the ntp.
The uninstall dialog used to say:
[===============================x]
|Confirm Uninstallation |
|--------------------------------|
|<b>Uninstall Foo Extension?</b> |
| |
|Are you sure you want to |
|uninstall this extension? |
| |
|================================|
We don't have the bottom string with the word 'app', and I
realized it is somewhat extraneous anyway. So just removed it
in all cases and de-bolded the text above. Looks much better.
Also, fixed a bug where the icon we display in the GTK
dialogs is too big by doing image resizing in
ExtensionInstallUI.
BUG=54874
TEST=Uninstall app and extension. Both should have a prompt,
and UI layout should be the same.
Review URL: http://codereview.chromium.org/3332016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/app_launcher_handler.cc')
-rw-r--r-- | chrome/browser/dom_ui/app_launcher_handler.cc | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc index 46cf478..7049d05 100644 --- a/chrome/browser/dom_ui/app_launcher_handler.cc +++ b/chrome/browser/dom_ui/app_launcher_handler.cc @@ -6,6 +6,7 @@ #include "app/animation.h" #include "base/string_number_conversions.h" +#include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/app_launched_animation.h" @@ -197,11 +198,42 @@ void AppLauncherHandler::AnimateAppIcon(Extension* extension, void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { std::string extension_id = WideToUTF8(ExtractStringValue(args)); + Extension* extension = extensions_service_->GetExtensionById( + extension_id, false); + if (!extension) + return; + + if (!extension_id_prompting_.empty()) + return; // Only one prompt at a time. + + extension_id_prompting_ = extension_id; + GetExtensionInstallUI()->ConfirmUninstall(this, extension); +} + +ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { + if (!install_ui_.get()) + install_ui_.reset(new ExtensionInstallUI(dom_ui_->GetProfile())); + return install_ui_.get(); +} - // Make sure that the extension exists. +void AppLauncherHandler::InstallUIProceed(bool create_app_shortcut) { + // We only ever use ExtensionInstallUI for uninstalling, which should never + // result in it telling us to create a shortcut. + DCHECK(!create_app_shortcut); + DCHECK(!extension_id_prompting_.empty()); + + // The extension can be uninstalled in another window while the UI was + // showing. Do nothing in that case. Extension* extension = - extensions_service_->GetExtensionById(extension_id, false); - DCHECK(extension); + extensions_service_->GetExtensionById(extension_id_prompting_, true); + if (!extension) + return; + + extensions_service_->UninstallExtension(extension_id_prompting_, + false /* external_uninstall */); + extension_id_prompting_ = ""; +} - extensions_service_->UninstallExtension(extension_id, false); +void AppLauncherHandler::InstallUIAbort() { + extension_id_prompting_ = ""; } |