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

Unified Diff: chrome/browser/shell_integration_linux.cc

Issue 253403002: Linux: The App Launcher now appears on the "Internet" menu, not "Other". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a global array, instead of a global pointer to a string. Created 6 years, 8 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_linux_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
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 9de486c1c0203695d158ef7b26a6cb9db49b9fb9..b2b111e989b3ba906f913ea6b644f21ba3a40be3 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -50,6 +50,10 @@ using content::BrowserThread;
namespace {
+// The Categories for the App Launcher desktop shortcut. Should be the same as
+// the Chrome desktop shortcut, so they are in the same sub-menu.
+const char kAppListCategories[] = "Network;WebBrowser;";
+
// Helper to launch xdg scripts. We don't want them to ask any questions on the
// terminal etc. The function returns true if the utility launches and exits
// cleanly, in which case |exit_code| returns the utility's exit code.
@@ -757,12 +761,13 @@ std::string GetDesktopFileContents(
const base::string16& title,
const std::string& icon_name,
const base::FilePath& profile_path,
+ const std::string& categories,
bool no_display) {
CommandLine cmd_line = ShellIntegration::CommandLineArgsForLauncher(
url, extension_id, profile_path);
cmd_line.SetProgram(chrome_exe_path);
return GetDesktopFileContentsForCommand(cmd_line, app_name, url, title,
- icon_name, no_display);
+ icon_name, categories, no_display);
}
std::string GetDesktopFileContentsForCommand(
@@ -771,6 +776,7 @@ std::string GetDesktopFileContentsForCommand(
const GURL& url,
const base::string16& title,
const std::string& icon_name,
+ const std::string& categories,
bool no_display) {
// Although not required by the spec, Nautilus on Ubuntu Karmic creates its
// launchers with an xdg-open shebang. Follow that convention.
@@ -808,6 +814,12 @@ std::string GetDesktopFileContentsForCommand(
GetIconName().c_str());
}
+ // Set the "Categories" key.
+ if (!categories.empty()) {
+ g_key_file_set_string(
+ key_file, kDesktopEntry, "Categories", categories.c_str());
+ }
+
// Set the "NoDisplay" key.
if (no_display)
g_key_file_set_string(key_file, kDesktopEntry, "NoDisplay", "true");
@@ -917,6 +929,7 @@ bool CreateDesktopShortcut(
shortcut_info.title,
icon_name,
shortcut_info.profile_path,
+ "",
false);
success = CreateShortcutOnDesktop(shortcut_filename, contents);
}
@@ -949,6 +962,7 @@ bool CreateDesktopShortcut(
shortcut_info.title,
icon_name,
shortcut_info.profile_path,
+ "",
creation_locations.applications_menu_location ==
web_app::APP_MENU_LOCATION_NONE);
success = CreateShortcutInApplicationsMenu(
@@ -987,9 +1001,14 @@ bool CreateAppListDesktopShortcut(
CommandLine command_line(chrome_exe_path);
command_line.AppendSwitch(switches::kShowAppList);
- std::string contents = GetDesktopFileContentsForCommand(
- command_line, wm_class, GURL(), base::UTF8ToUTF16(title), icon_name,
- false);
+ std::string contents =
+ GetDesktopFileContentsForCommand(command_line,
+ wm_class,
+ GURL(),
+ base::UTF8ToUTF16(title),
+ icon_name,
+ kAppListCategories,
+ false);
return CreateShortcutInApplicationsMenu(
shortcut_filename, contents, base::FilePath(), "");
}
« no previous file with comments | « chrome/browser/shell_integration_linux.h ('k') | chrome/browser/shell_integration_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698