Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
index 5f3684b9afd5cb2e1e4a1e64068ed5353596e0a0..6cd16b614c6c81e1a8275d7ad4f3d2dfa25ed8f1 100644 |
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
@@ -78,7 +78,8 @@ AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service) |
: extension_service_(extension_service), |
ignore_changes_(false), |
attempted_bookmark_app_install_(false), |
- has_loaded_apps_(false) { |
+ has_loaded_apps_(false), |
+ uninstall_from_page_(false) { |
} |
AppLauncherHandler::~AppLauncherHandler() {} |
@@ -305,8 +306,10 @@ void AppLauncherHandler::Observe(int type, |
content::Details<UnloadedExtensionInfo>(details)->reason == |
extension_misc::UNLOAD_REASON_UNINSTALL)); |
if (app_info.get()) { |
+ scoped_ptr<base::FundamentalValue> from_page( |
+ Value::CreateBooleanValue(uninstall_from_page_)); |
web_ui()->CallJavascriptFunction( |
- "ntp4.appRemoved", *app_info, *uninstall_value); |
+ "ntp4.appRemoved", *app_info, *uninstall_value, *from_page); |
} |
break; |
} |
@@ -314,7 +317,7 @@ void AppLauncherHandler::Observe(int type, |
// The promo may not load until a couple seconds after the first NTP view, |
// so we listen for the load notification and notify the NTP when ready. |
case chrome::NOTIFICATION_WEB_STORE_PROMO_LOADED: |
- // TODO(estade): try to get rid of this inefficient operation. |
+ // TODO(estade): Try to get rid of this inefficient operation. |
HandleGetApps(NULL); |
break; |
case chrome::NOTIFICATION_PREF_CHANGED: { |
@@ -329,7 +332,7 @@ void AppLauncherHandler::Observe(int type, |
crx_installer->profile())) { |
return; |
} |
- // Fall Through. |
+ // Fall through. |
} |
case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: { |
attempted_bookmark_app_install_ = false; |
@@ -620,6 +623,9 @@ void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
AutoReset<bool> auto_reset(&ignore_changes_, true); |
ExtensionUninstallAccepted(); |
} else { |
+ // We don't use an AutoReset<bool> here as the uninstall dialog runs in a |
Evan Stade
2012/01/17 19:45:29
the uninstall dialog runs in the UI thread, same a
Dan Beam
2012/01/18 00:07:23
Done. (removed because of following review comment
|
+ // different thread so it's not sync. |
+ uninstall_from_page_ = true; |
Evan Stade
2012/01/17 19:45:29
I don't see why you need this new boolean. What is
Dan Beam
2012/01/17 21:33:09
Done.
|
GetExtensionUninstallDialog()->ConfirmUninstall(extension); |
} |
} |
@@ -842,6 +848,11 @@ void AppLauncherHandler::RegisterUserPrefs(PrefService* pref_service) { |
PrefService::UNSYNCABLE_PREF); |
} |
+void AppLauncherHandler::CleanupAfterUninstall() { |
+ uninstall_from_page_ = false; |
+ extension_id_prompting_ = ""; |
Evan Stade
2012/01/17 19:45:29
.clear()
Dan Beam
2012/01/18 00:04:27
Done.
|
+} |
+ |
// static |
void AppLauncherHandler::RecordWebStoreLaunch(bool promo_active) { |
UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
@@ -927,12 +938,11 @@ void AppLauncherHandler::ExtensionUninstallAccepted() { |
extension_service_->UninstallExtension(extension_id_prompting_, |
false /* external_uninstall */, NULL); |
- |
- extension_id_prompting_ = ""; |
+ CleanupAfterUninstall(); |
} |
void AppLauncherHandler::ExtensionUninstallCanceled() { |
- extension_id_prompting_ = ""; |
+ CleanupAfterUninstall(); |
} |
void AppLauncherHandler::InstallUIProceed() { |
@@ -969,7 +979,7 @@ void AppLauncherHandler::InstallUIAbort(bool user_initiated) { |
ExtensionService::RecordPermissionMessagesHistogram( |
extension, histogram_name.c_str()); |
- ExtensionUninstallCanceled(); |
+ CleanupAfterUninstall(); |
} |
ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { |