Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7393)

Unified Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 3332016: Add a confirmation prompt to app uninstallation on the ntp. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: fix layout on Windows, remove some old crap Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/app_launcher_handler.h ('k') | chrome/browser/extensions/extension_install_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ = "";
}
« no previous file with comments | « chrome/browser/dom_ui/app_launcher_handler.h ('k') | chrome/browser/extensions/extension_install_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698