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

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 22210003: Track extension uninstalls on the NTP to catch uninstalls of disabled apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4de0128b9fe66f6b2e229ee181f1160d9cd95b76..b7de4478b9db3425b8754823c3fa81046dd8c0e3 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -270,10 +270,23 @@ void AppLauncherHandler::Observe(int type,
break;
}
- case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
- const Extension* extension =
- content::Details<extensions::UnloadedExtensionInfo>(
- details)->extension;
+ case chrome::NOTIFICATION_EXTENSION_UNLOADED:
+ case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
+ const Extension* extension = NULL;
+ bool uninstalled = false;
+ if (type == chrome::NOTIFICATION_EXTENSION_UNINSTALLED) {
+ extension = content::Details<const Extension>(details).ptr();
+ uninstalled = true;
+ } else { // NOTIFICATION_EXTENSION_UNLOADED
+ if (content::Details<extensions::UnloadedExtensionInfo>(
+ details)->reason == extension_misc::UNLOAD_REASON_UNINSTALL) {
+ // Uninstalls are tracked by NOTIFICATION_EXTENSION_UNINSTALLED.
+ return;
+ }
+ extension = content::Details<extensions::UnloadedExtensionInfo>(
+ details)->extension;
+ uninstalled = false;
+ }
if (!extension->is_app())
return;
@@ -282,13 +295,11 @@ void AppLauncherHandler::Observe(int type,
return;
scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension));
- scoped_ptr<base::FundamentalValue> uninstall_value(
- Value::CreateBooleanValue(
- content::Details<extensions::UnloadedExtensionInfo>(
- details)->reason == extension_misc::UNLOAD_REASON_UNINSTALL));
if (app_info.get()) {
visible_apps_.erase(extension->id());
+ scoped_ptr<base::FundamentalValue> uninstall_value(
+ Value::CreateBooleanValue(uninstalled));
scoped_ptr<base::FundamentalValue> from_page(
Value::CreateBooleanValue(!extension_id_prompting_.empty()));
web_ui()->CallJavascriptFunction(
@@ -445,6 +456,8 @@ void AppLauncherHandler::HandleGetApps(const ListValue* args) {
content::Source<Profile>(profile));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile));
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
+ content::Source<Profile>(profile));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED,
content::Source<ExtensionSorting>(
extension_service_->extension_prefs()->extension_sorting()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698