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

Unified Diff: chrome/browser/shell_integration_linux.cc

Issue 10735048: Revert 146065 - Remove app shortcuts when app is uninstalled on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | « chrome/browser/shell_integration_linux.h ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration_linux.cc
===================================================================
--- chrome/browser/shell_integration_linux.cc (revision 146065)
+++ chrome/browser/shell_integration_linux.cc (working copy)
@@ -154,12 +154,6 @@
return true;
}
-void DeleteShortcutOnDesktop(const FilePath& shortcut_filename) {
- FilePath desktop_path;
- if (PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
- file_util::Delete(desktop_path.Append(shortcut_filename), false);
-}
-
bool CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename,
const std::string& contents) {
ScopedTempDir temp_dir;
@@ -189,22 +183,6 @@
return exit_code == 0;
}
-void DeleteShortcutInApplicationsMenu(const FilePath& shortcut_filename) {
- std::vector<std::string> argv;
- argv.push_back("xdg-desktop-menu");
- argv.push_back("uninstall");
-
- // Uninstall in user mode, to match the install.
- argv.push_back("--mode");
- argv.push_back("user");
-
- // The file does not need to exist anywhere - xdg-desktop-menu will uninstall
- // items from the menu with a matching name.
- argv.push_back(shortcut_filename.value());
- int exit_code;
- LaunchXdgUtility(argv, &exit_code);
-}
-
// Quote a string such that it appears as one verbatim argument for the Exec
// key in a desktop file.
std::string QuoteArgForDesktopFileExec(const std::string& arg) {
@@ -477,7 +455,7 @@
return false;
}
-FilePath GetWebShortcutFilename(const GURL& url) {
+FilePath GetDesktopShortcutFilename(const GURL& url) {
// Use a prefix, because xdg-desktop-menu requires it.
std::string filename =
std::string(chrome::kBrowserProcessExecutableName) + "-" + url.spec();
@@ -501,20 +479,6 @@
return FilePath();
}
-FilePath GetExtensionShortcutFilename(const FilePath& profile_path,
- const std::string& extension_id) {
- DCHECK(!extension_id.empty());
-
- // Use a prefix, because xdg-desktop-menu requires it.
- std::string filename(chrome::kBrowserProcessExecutableName);
- filename.append("-")
- .append(extension_id)
- .append("-")
- .append(profile_path.BaseName().value());
- file_util::ReplaceIllegalCharactersInPath(&filename, '_');
- return FilePath(filename.append(".desktop"));
-}
-
std::string GetDesktopFileContents(
const std::string& template_contents,
const std::string& app_name,
@@ -633,19 +597,8 @@
const std::string& shortcut_template) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- FilePath shortcut_filename;
- if (!shortcut_info.extension_id.empty()) {
- shortcut_filename = GetExtensionShortcutFilename(
- shortcut_info.profile_path, shortcut_info.extension_id);
- // For extensions we do not want duplicate shortcuts. So, delete any that
- // already exist and replace them.
- if (shortcut_info.create_on_desktop)
- DeleteShortcutOnDesktop(shortcut_filename);
- if (shortcut_info.create_in_applications_menu)
- DeleteShortcutInApplicationsMenu(shortcut_filename);
- } else {
- shortcut_filename = GetWebShortcutFilename(shortcut_info.url);
- }
+ FilePath shortcut_filename =
+ ShellIntegrationLinux::GetDesktopShortcutFilename(shortcut_info.url);
if (shortcut_filename.empty())
return false;
@@ -676,16 +629,4 @@
return success;
}
-void DeleteDesktopShortcuts(const FilePath& profile_path,
- const std::string& extension_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
-
- FilePath shortcut_filename = GetExtensionShortcutFilename(
- profile_path, extension_id);
- DCHECK(!shortcut_filename.empty());
-
- DeleteShortcutOnDesktop(shortcut_filename);
- DeleteShortcutInApplicationsMenu(shortcut_filename);
-}
-
} // namespace ShellIntegrationLinux
« no previous file with comments | « chrome/browser/shell_integration_linux.h ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698