diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 09:50:47 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 09:50:47 +0000 |
commit | 0b7df36d890f91898179b2a90a98c90e4c065f48 (patch) | |
tree | 303b7057cdf9c26feb47762140146aeffdc861a8 /chrome/browser/web_applications | |
parent | fd9a6331e8aafb8d919bcc846c110ca5fbb1a24b (diff) | |
download | chromium_src-0b7df36d890f91898179b2a90a98c90e4c065f48.zip chromium_src-0b7df36d890f91898179b2a90a98c90e4c065f48.tar.gz chromium_src-0b7df36d890f91898179b2a90a98c90e4c065f48.tar.bz2 |
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.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=146065
Review URL: https://chromiumcodereview.appspot.com/10698114
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_applications')
-rw-r--r-- | chrome/browser/web_applications/web_app.cc | 14 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app.h | 11 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_linux.cc | 5 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_mac.mm | 6 | ||||
-rw-r--r-- | chrome/browser/web_applications/web_app_win.cc | 5 |
5 files changed, 39 insertions, 2 deletions
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index a502b5a..c2b2a34 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -127,8 +127,18 @@ void CreateShortcut( BrowserThread::FILE, FROM_HERE, base::Bind(base::IgnoreResult(&CreateShortcutOnFileThread), - profile_path, - shortcut_info)); + profile_path, shortcut_info)); +} + +void DeleteAllShortcuts(const FilePath& profile_path, + const std::string& extension_id) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + + BrowserThread::PostTask( + BrowserThread::FILE, + FROM_HERE, + base::Bind(&internals::DeletePlatformShortcuts, profile_path, + extension_id)); } bool CreateShortcutOnFileThread( diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index 253c88f..bcd445a 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -54,6 +54,11 @@ void CreateShortcut( const FilePath& profile_path, const ShellIntegration::ShortcutInfo& shortcut_info); +// Delete all the shortcuts that have been created for the extension with +// |extension_id| in the profile with |profile_path|. +void DeleteAllShortcuts(const FilePath& profile_path, + const std::string& extension_id); + // Creates a shortcut. Must be called on the file thread. This is used to // implement CreateShortcut() above, and can also be used directly from the // file thread. |profile_path| is the path of the creating profile. @@ -97,6 +102,12 @@ bool CreatePlatformShortcut( const FilePath& profile_path, const ShellIntegration::ShortcutInfo& shortcut_info); +// Delete all the shortcuts we have added for this extension. This is the +// platform specific implementation of the DeleteAllShortcuts function, and +// is executed on the FILE thread.. +void DeletePlatformShortcuts(const FilePath& profile_path, + const std::string& extension_id); + // Sanitizes |name| and returns a version of it that is safe to use as an // on-disk file name . FilePath GetSanitizedFileName(const string16& name); diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index e26be43..56d02fbf 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -29,5 +29,10 @@ bool CreatePlatformShortcut( shortcut_info, shortcut_template); } +void DeletePlatformShortcuts(const FilePath& profile_path, + const std::string& extension_id) { + ShellIntegrationLinux::DeleteDesktopShortcuts(profile_path, extension_id); +} + } // namespace internals } // namespace web_app diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index de64f35..e4d22f0 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -262,5 +262,11 @@ bool CreatePlatformShortcut( return shortcut_creator.CreateShortcut(); } +void DeletePlatformShortcuts(const FilePath& profile_path, + const std::string& extension_id) { + // TODO(benwells): Implement this when shortcuts / weblings are enabled on + // mac. +} + } // namespace internals } // namespace web_app diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index f6cbbbf1..f5d85bd 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -255,6 +255,11 @@ bool CreatePlatformShortcut( return success; } +void DeletePlatformShortcuts(const FilePath& profile_path, + const std::string& extension_id) { + // TODO(benwells): Implement this. +} + } // namespace internals } // namespace web_app |