Index: chrome/browser/shell_integration_linux.cc |
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc |
index f72b63d7fe50d6dd1e78f68954413101833af264..ea68e6aa484f31d888ad1fbe5f708484d098a935 100644 |
--- a/chrome/browser/shell_integration_linux.cc |
+++ b/chrome/browser/shell_integration_linux.cc |
@@ -40,6 +40,8 @@ |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_version_info.h" |
#include "content/public/browser/browser_thread.h" |
+#include "grit/chromium_strings.h" |
+#include "ui/base/l10n/l10n_util.h" |
gab
2013/10/17 15:13:31
Includes no longer required.
calamity
2013/11/20 05:43:30
Done.
|
#include "ui/gfx/image/image_family.h" |
#include "url/gurl.h" |
@@ -586,7 +588,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations( |
// If Get returns false, just leave desktop_path empty. |
PathService::Get(base::DIR_USER_DESKTOP, &desktop_path); |
return GetExistingShortcutLocations(env, profile_path, extension_id, |
- desktop_path); |
+ desktop_path); |
} |
ShellIntegration::ShortcutLocations GetExistingShortcutLocations( |
@@ -610,12 +612,16 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations( |
// Determine whether there is a shortcut in the applications directory. |
std::string shortcut_contents; |
if (GetExistingShortcutContents(env, shortcut_filename, &shortcut_contents)) { |
- // Whether this counts as "hidden" or "in_applications_menu" depends on |
- // whether it contains NoDisplay=true. |
- if (GetNoDisplayFromDesktopFile(shortcut_contents)) |
+ // Whether this counts as "hidden" or |
+ // "APP_MENU_LOCATION_SUBDIR_CHROMEAPPS" depends on whether it contains |
huangs
2013/10/17 19:13:35
NIT: I think you can unwrap "APP_MENU_LOCATION_SUB
calamity
2013/11/20 05:43:30
Done.
|
+ // NoDisplay=true. Since these shortcuts are for apps, they are always in |
+ // the "Chrome Apps" directory. |
+ if (GetNoDisplayFromDesktopFile(shortcut_contents)) { |
locations.hidden = true; |
- else |
- locations.in_applications_menu = true; |
+ } else { |
+ locations.applications_menu_location = |
+ ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
+ } |
} |
return locations; |
@@ -842,7 +848,11 @@ bool CreateDesktopShortcut( |
// already exist and replace them. |
if (creation_locations.on_desktop) |
DeleteShortcutOnDesktop(shortcut_filename); |
- if (creation_locations.in_applications_menu || creation_locations.hidden) |
+ // The 'applications_menu_location' and 'hidden' locations are actually the |
+ // same place ('applications'). |
+ if (creation_locations.applications_menu_location != |
+ ShellIntegration::APP_MENU_LOCATION_NONE || |
gab
2013/10/17 15:13:31
nit: indent this line 4 spaces as it's a continuat
calamity
2013/11/20 05:43:30
Done.
|
+ creation_locations.hidden) |
DeleteShortcutInApplicationsMenu(shortcut_filename, base::FilePath()); |
} else { |
shortcut_filename = GetWebShortcutFilename(shortcut_info.url); |
@@ -877,18 +887,19 @@ bool CreateDesktopShortcut( |
success = CreateShortcutOnDesktop(shortcut_filename, contents); |
} |
- // The 'in_applications_menu' and 'hidden' locations are actually the same |
- // place ('applications'). |
- if (creation_locations.in_applications_menu || creation_locations.hidden) { |
+ if (creation_locations.applications_menu_location != |
+ ShellIntegration::APP_MENU_LOCATION_NONE || |
gab
2013/10/17 15:13:31
nit: indent 4 spaces in here too
calamity
2013/11/20 05:43:30
Done.
|
+ creation_locations.hidden) { |
base::FilePath directory_filename; |
std::string directory_contents; |
- if (!creation_locations.applications_menu_subdir.empty()) { |
+ if (creation_locations.applications_menu_location == |
+ ShellIntegration::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS) { |
gab
2013/10/17 15:13:31
nit: indent 4 spaces
calamity
2013/11/20 05:43:30
Done.
|
directory_filename = base::FilePath(kDirectoryFilename); |
directory_contents = ShellIntegrationLinux::GetDirectoryFileContents( |
- creation_locations.applications_menu_subdir, ""); |
+ ShellIntegration::GetAppShortcutsSubdirName(), ""); |
} |
- // Set NoDisplay=true if hidden but not in_applications_menu. This will hide |
- // the application from user-facing menus. |
+ // Set NoDisplay=true if hidden but not in the applications menu. This will |
+ // hide the application from user-facing menus. |
std::string contents = ShellIntegrationLinux::GetDesktopFileContents( |
chrome_exe_path, |
app_name, |
@@ -898,7 +909,8 @@ bool CreateDesktopShortcut( |
shortcut_info.title, |
icon_name, |
shortcut_info.profile_path, |
- !creation_locations.in_applications_menu); |
+ creation_locations.applications_menu_location == |
+ ShellIntegration::APP_MENU_LOCATION_NONE); |
success = CreateShortcutInApplicationsMenu( |
shortcut_filename, contents, directory_filename, directory_contents) && |
success; |
@@ -918,9 +930,8 @@ void DeleteDesktopShortcuts(const base::FilePath& profile_path, |
DeleteShortcutOnDesktop(shortcut_filename); |
// Delete shortcuts from |kDirectoryFilename|. |
// Note that it is possible that shortcuts were not created in the Chrome Apps |
- // directory (depending on the value of |applications_menu_subdir| when they |
- // were created). It doesn't matter: this will still delete the shortcut even |
- // if it isn't in the directory. |
+ // directory. It doesn't matter: this will still delete the shortcut even if |
+ // it isn't in the directory. |
DeleteShortcutInApplicationsMenu(shortcut_filename, |
base::FilePath(kDirectoryFilename)); |
} |