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

Unified Diff: chrome/browser/extensions/app_shortcut_manager.cc

Issue 10698114: Remove app shortcuts when app is uninstalled on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fix Created 8 years, 5 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 | chrome/browser/shell_integration_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/app_shortcut_manager.cc
diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc
index 53aba19dcb9ab311789f31967f4b06da1105e0ab..a3357f80cd241713c78dba0d386dff14d10f01d8 100644
--- a/chrome/browser/extensions/app_shortcut_manager.cc
+++ b/chrome/browser/extensions/app_shortcut_manager.cc
@@ -36,6 +36,8 @@ AppShortcutManager::AppShortcutManager(Profile* profile)
tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
content::Source<Profile>(profile_));
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
+ content::Source<Profile>(profile_));
}
void AppShortcutManager::OnImageLoaded(const gfx::Image& image,
@@ -61,15 +63,28 @@ void AppShortcutManager::OnImageLoaded(const gfx::Image& image,
void AppShortcutManager::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(type == chrome::NOTIFICATION_EXTENSION_INSTALLED);
- #if !defined(OS_MACOSX)
- const Extension* extension = content::Details<const Extension>(
- details).ptr();
- if (!disable_shortcut_creation_for_tests &&
- extension->is_platform_app() &&
- extension->location() != Extension::LOAD)
- InstallApplicationShortcuts(extension);
- #endif
+#if !defined(OS_MACOSX)
+ switch (type) {
+ case chrome::NOTIFICATION_EXTENSION_INSTALLED: {
+ const Extension* extension = content::Details<const Extension>(
+ details).ptr();
+ if (!disable_shortcut_creation_for_tests &&
+ extension->is_platform_app() &&
+ extension->location() != Extension::LOAD) {
+ InstallApplicationShortcuts(extension);
+ }
+ break;
+ }
+ case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: {
+ std::string extension_id = *content::Details<std::string>(details).ptr();
+ if (!disable_shortcut_creation_for_tests)
+ web_app::DeleteAllShortcuts(profile_->GetPath(), extension_id);
+ break;
+ }
+ default:
+ NOTREACHED();
+ }
+#endif
}
// static
« no previous file with comments | « no previous file | chrome/browser/shell_integration_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698