Index: chrome/browser/ui/webui/app_launcher_handler.cc |
diff --git a/chrome/browser/ui/webui/app_launcher_handler.cc b/chrome/browser/ui/webui/app_launcher_handler.cc |
index c9631594a42b2b71f206f7b3d06c9521fda5daa2..4f37c86d93c969f3f6fb0df8da71228d4be94ba0 100644 |
--- a/chrome/browser/ui/webui/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/app_launcher_handler.cc |
@@ -63,7 +63,7 @@ extension_misc::AppLaunchBucket ParseLaunchSource(std::string launch_source) { |
AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service) |
: extensions_service_(extension_service), |
- extension_prompt_type_(ExtensionInstallUI::UNSET_PROMPT_TYPE), |
+ is_uninstall_dialog_(false), |
promo_active_(false), |
ignore_changes_(false) { |
} |
@@ -406,8 +406,8 @@ void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
return; // Only one prompt at a time. |
extension_id_prompting_ = extension_id; |
- extension_prompt_type_ = ExtensionInstallUI::UNINSTALL_PROMPT; |
- GetExtensionInstallUI()->ConfirmUninstall(this, extension); |
+ is_uninstall_dialog_ = true; |
+ GetExtensionGenericDialog()->ConfirmUninstall(this, extension); |
} |
void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) { |
@@ -538,11 +538,11 @@ void AppLauncherHandler::PromptToEnableApp(std::string extension_id) { |
return; // Only one prompt at a time. |
extension_id_prompting_ = extension_id; |
- extension_prompt_type_ = ExtensionInstallUI::RE_ENABLE_PROMPT; |
+ is_uninstall_dialog_ = false; |
GetExtensionInstallUI()->ConfirmReEnable(this, extension); |
} |
-void AppLauncherHandler::InstallUIProceed() { |
+void AppLauncherHandler::ExtensionDialogAccepted() { |
DCHECK(!extension_id_prompting_.empty()); |
// The extension can be uninstalled in another window while the UI was |
@@ -552,12 +552,10 @@ void AppLauncherHandler::InstallUIProceed() { |
if (!extension) |
return; |
- switch (extension_prompt_type_) { |
- case ExtensionInstallUI::UNINSTALL_PROMPT: |
+ if (is_uninstall_dialog_) { |
extensions_service_->UninstallExtension(extension_id_prompting_, |
false /* external_uninstall */); |
- break; |
- case ExtensionInstallUI::RE_ENABLE_PROMPT: { |
+ } else { |
extensions_service_->GrantPermissionsAndEnableExtension(extension); |
// We bounce this off the NTP so the browser can update the apps icon. |
@@ -566,24 +564,37 @@ void AppLauncherHandler::InstallUIProceed() { |
// visual experience. |
StringValue* app_id = Value::CreateStringValue(extension->id()); |
web_ui_->CallJavascriptFunction("launchAppAfterEnable", *app_id); |
- break; |
- } |
- default: |
- NOTREACHED(); |
- break; |
} |
extension_id_prompting_ = ""; |
} |
-void AppLauncherHandler::InstallUIAbort() { |
+void AppLauncherHandler::ExtensionDialogCanceled() { |
extension_id_prompting_ = ""; |
} |
+void AppLauncherHandler::InstallUIProceed() { |
+ ExtensionDialogAccepted(); |
Aaron Boodman
2011/03/24 19:22:03
Since the code to run in the uninstall case and th
tfarina
2011/03/24 21:39:47
Done.
|
+} |
+ |
+void AppLauncherHandler::InstallUIAbort() { |
+ ExtensionDialogCanceled(); |
+} |
+ |
+ExtensionGenericDialog* AppLauncherHandler::GetExtensionGenericDialog() { |
+ if (!extension_generic_dialog_.get()) { |
+ extension_generic_dialog_.reset( |
+ new ExtensionGenericDialog(web_ui_->GetProfile())); |
+ } |
+ return extension_generic_dialog_.get(); |
+} |
+ |
ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { |
- if (!install_ui_.get()) |
- install_ui_.reset(new ExtensionInstallUI(web_ui_->GetProfile())); |
- return install_ui_.get(); |
+ if (!extension_install_ui_.get()) { |
+ extension_install_ui_.reset( |
+ new ExtensionInstallUI(web_ui_->GetProfile())); |
+ } |
+ return extension_install_ui_.get(); |
} |
void AppLauncherHandler::UninstallDefaultApps() { |