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..71be6516150f67f0dd725ea43bb4fc89c96de897 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,23 @@ 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) |
+#if !defined(OS_MACOSX) |
+ if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { |
koz (OOO until 15th September)
2012/07/10 00:23:52
if / else if / else -> switch?
|
const Extension* extension = content::Details<const Extension>( |
details).ptr(); |
if (!disable_shortcut_creation_for_tests && |
extension->is_platform_app() && |
- extension->location() != Extension::LOAD) |
+ extension->location() != Extension::LOAD) { |
InstallApplicationShortcuts(extension); |
- #endif |
+ } |
+ } else if (type == 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); |
+ } else { |
+ NOTREACHED(); |
+ } |
+#endif |
} |
// static |