Chromium Code Reviews| Index: chrome/browser/shell_integration_linux.cc |
| diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc |
| index b6bd6a6cf7f0f6ceb63a5c406c136af069cee280..ef03b3b90e3897374d683ecea175434c27a32e93 100644 |
| --- a/chrome/browser/shell_integration_linux.cc |
| +++ b/chrome/browser/shell_integration_linux.cc |
| @@ -29,6 +29,7 @@ |
| #include "base/task.h" |
| #include "base/threading/thread.h" |
| #include "base/utf_string_conversions.h" |
| +#include "chrome/browser/web_applications/web_app.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "content/browser/browser_thread.h" |
| @@ -360,8 +361,11 @@ FilePath ShellIntegration::GetDesktopShortcutFilename(const GURL& url) { |
| // static |
| std::string ShellIntegration::GetDesktopFileContents( |
| - const std::string& template_contents, const GURL& url, |
| - const std::string& extension_id, const string16& title, |
| + const std::string& template_contents, |
| + const std::string& app_name, |
| + const GURL& url, |
| + const std::string& extension_id, |
| + const string16& title, |
| const std::string& icon_name) { |
| // See http://standards.freedesktop.org/desktop-entry-spec/latest/ |
| // Although not required by the spec, Nautilus on Ubuntu Karmic creates its |
| @@ -410,6 +414,9 @@ std::string ShellIntegration::GetDesktopFileContents( |
| } else if (tokenizer.token().substr(0, 9) == "MimeType=") { |
| // Skip MimeType lines, they are only relevant for a web browser |
| // shortcut, not a web application shortcut. |
| + } else if (tokenizer.token().substr(0, 15) == "StartupWMClass=") { |
| + // Skip StartupWMClass; it will cerrtainly be wrong since we emit a |
|
Evan Stade
2011/04/05 21:12:08
certainly
|
| + // different one based on the app name below. |
| } else if (tokenizer.token().substr(0, 5) == "Icon=" && |
| !icon_name.empty()) { |
| output_buffer += StringPrintf("Icon=%s\n", icon_name.c_str()); |
| @@ -417,6 +424,11 @@ std::string ShellIntegration::GetDesktopFileContents( |
| output_buffer += tokenizer.token() + "\n"; |
| } |
| } |
| + |
| + output_buffer += "StartupWMClass="; |
|
Evan Stade
2011/04/05 21:12:08
I'd slightly prefer
output_buffer += foo + bar
|
| + output_buffer += web_app::GetWMClassFromAppName(app_name); |
| + output_buffer += "\n"; |
| + |
| return output_buffer; |
| } |
| @@ -433,9 +445,15 @@ void ShellIntegration::CreateDesktopShortcut( |
| std::string icon_name = CreateShortcutIcon(shortcut_info, shortcut_filename); |
| + std::string app_name = |
| + web_app::GenerateApplicationNameFromInfo(shortcut_info); |
| std::string contents = GetDesktopFileContents( |
| - shortcut_template, shortcut_info.url, shortcut_info.extension_id, |
| - shortcut_info.title, icon_name); |
| + shortcut_template, |
| + app_name, |
| + shortcut_info.url, |
| + shortcut_info.extension_id, |
| + shortcut_info.title, |
| + icon_name); |
| if (shortcut_info.create_on_desktop) |
| CreateShortcutOnDesktop(shortcut_filename, contents); |