| Index: chrome/browser/dom_ui/app_launcher_handler.cc
|
| diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
|
| index 46cf4788bfb7c3e4cc5a207faf881c17a0a6420d..7049d056ed16e88d524ce71defa6233b38db0abf 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_ = "";
|
| }
|
|
|