From 30cdf3af7e307e5334895b439ea63c29025f7650 Mon Sep 17 00:00:00 2001 From: "benwells@chromium.org" Date: Wed, 11 Jul 2012 06:41:50 +0000 Subject: Revert 146065 - Remove app shortcuts when app is uninstalled on Linux. To support this, shortcut creation on Linux for extensions has been modified so that the filename encodes the extension ID and the profile. Also, when creating shortcuts any existing shortcuts are removed first. Web page shortcuts are not affected. BUG=130456 TEST=Test uninstalling apps removes their shortcuts; test uninstalling apps is not broken in any way; test shortcuts for web apps are not broken in any way. Review URL: https://chromiumcodereview.appspot.com/10698114 TBR=benwells@chromium.org Review URL: https://chromiumcodereview.appspot.com/10735048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146066 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/app_shortcut_manager.cc | 33 +++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) (limited to 'chrome/browser/extensions') diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc index a3357f8..53aba19 100644 --- a/chrome/browser/extensions/app_shortcut_manager.cc +++ b/chrome/browser/extensions/app_shortcut_manager.cc @@ -36,8 +36,6 @@ AppShortcutManager::AppShortcutManager(Profile* profile) tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, content::Source(profile_)); - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, - content::Source(profile_)); } void AppShortcutManager::OnImageLoaded(const gfx::Image& image, @@ -63,28 +61,15 @@ void AppShortcutManager::OnImageLoaded(const gfx::Image& image, void AppShortcutManager::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { -#if !defined(OS_MACOSX) - switch (type) { - case chrome::NOTIFICATION_EXTENSION_INSTALLED: { - const Extension* extension = content::Details( - 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(details).ptr(); - if (!disable_shortcut_creation_for_tests) - web_app::DeleteAllShortcuts(profile_->GetPath(), extension_id); - break; - } - default: - NOTREACHED(); - } -#endif + DCHECK(type == chrome::NOTIFICATION_EXTENSION_INSTALLED); + #if !defined(OS_MACOSX) + const Extension* extension = content::Details( + details).ptr(); + if (!disable_shortcut_creation_for_tests && + extension->is_platform_app() && + extension->location() != Extension::LOAD) + InstallApplicationShortcuts(extension); + #endif } // static -- cgit v1.1