Index: chrome/browser/web_applications/web_app_win.cc |
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc |
index 92ef88ebdb8d1de9b7220e311bd3f4c662add810..d7bac7f376fa5ca4ec0401e325af1bfb17944b1f 100644 |
--- a/chrome/browser/web_applications/web_app_win.cc |
+++ b/chrome/browser/web_applications/web_app_win.cc |
@@ -18,6 +18,7 @@ |
#include "chrome/common/chrome_switches.h" |
#include "chrome/installer/launcher_support/chrome_launcher_support.h" |
#include "chrome/installer/util/browser_distribution.h" |
+#include "chrome/installer/util/util_constants.h" |
#include "content/public/browser/browser_thread.h" |
#include "ui/gfx/icon_util.h" |
#include "ui/gfx/image/image.h" |
@@ -80,59 +81,6 @@ bool ShouldUpdateIcon(const base::FilePath& icon_file, const SkBitmap& image) { |
sizeof(base::MD5Digest)) != 0; |
} |
-std::vector<base::FilePath> GetShortcutPaths( |
- const ShellIntegration::ShortcutLocations& creation_locations) { |
- // Shortcut paths under which to create shortcuts. |
- std::vector<base::FilePath> shortcut_paths; |
- |
- // Locations to add to shortcut_paths. |
- struct { |
- bool use_this_location; |
- int location_id; |
- const wchar_t* sub_dir; |
- } locations[] = { |
- { |
- creation_locations.on_desktop, |
- base::DIR_USER_DESKTOP, |
- NULL |
- }, { |
- creation_locations.in_applications_menu, |
- base::DIR_START_MENU, |
- NULL |
- }, { |
- creation_locations.in_quick_launch_bar, |
- // For Win7, create_in_quick_launch_bar means pinning to taskbar. Use |
- // base::PATH_START as a flag for this case. |
- (base::win::GetVersion() >= base::win::VERSION_WIN7) ? |
- base::PATH_START : base::DIR_APP_DATA, |
- (base::win::GetVersion() >= base::win::VERSION_WIN7) ? |
- NULL : L"Microsoft\\Internet Explorer\\Quick Launch" |
- } |
- }; |
- |
- // Populate shortcut_paths. |
- for (int i = 0; i < arraysize(locations); ++i) { |
- if (locations[i].use_this_location) { |
- base::FilePath path; |
- |
- // Skip the Win7 case. |
- if (locations[i].location_id == base::PATH_START) |
- continue; |
- |
- if (!PathService::Get(locations[i].location_id, &path)) { |
- continue; |
- } |
- |
- if (locations[i].sub_dir != NULL) |
- path = path.Append(locations[i].sub_dir); |
- |
- shortcut_paths.push_back(path); |
- } |
- } |
- |
- return shortcut_paths; |
-} |
- |
bool ShortcutIsForProfile(const base::FilePath& shortcut_file_name, |
const base::FilePath& profile_path) { |
string16 cmd_line_string; |
@@ -281,7 +229,7 @@ bool CreatePlatformShortcuts( |
bool success = true; |
for (size_t i = 0; i < shortcut_paths.size(); ++i) { |
base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). |
- AddExtension(FILE_PATH_LITERAL(".lnk")); |
+ AddExtension(installer::kLnkExt); |
if (shortcut_paths[i] != web_app_path) { |
int unique_number = |
file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL("")); |
@@ -310,7 +258,7 @@ bool CreatePlatformShortcuts( |
// Use the web app path shortcut for pinning to avoid having unique numbers |
// in the application name. |
base::FilePath shortcut_to_pin = web_app_path.Append(file_name). |
- AddExtension(FILE_PATH_LITERAL(".lnk")); |
+ AddExtension(installer::kLnkExt); |
success = base::win::TaskbarPinShortcutLink( |
shortcut_to_pin.value().c_str()) && success; |
} |
@@ -364,6 +312,56 @@ void DeletePlatformShortcuts( |
} |
} |
+std::vector<base::FilePath> GetShortcutPaths( |
gab
2013/04/23 17:59:57
These locations are wrong if this is a system-leve
calamity
2013/04/26 04:38:49
Just making sure: if Chrome is a system install, i
|
+ const ShellIntegration::ShortcutLocations& creation_locations) { |
+ // Shortcut paths under which to create shortcuts. |
+ std::vector<base::FilePath> shortcut_paths; |
+ // Locations to add to shortcut_paths. |
+ struct { |
+ bool use_this_location; |
+ int location_id; |
+ const wchar_t* subdir; |
+ } locations[] = { |
+ { |
+ creation_locations.on_desktop, |
+ base::DIR_USER_DESKTOP, |
+ NULL |
+ }, { |
+ creation_locations.in_applications_menu, |
+ base::DIR_START_MENU, |
+ creation_locations.applications_menu_subdir.empty() ? NULL : |
+ creation_locations.applications_menu_subdir.c_str() |
+ }, { |
+ creation_locations.in_quick_launch_bar, |
gab
2013/04/23 17:59:57
Why not simply make this
creation_locations.in_qui
calamity
2013/04/26 04:38:49
Left the special casing in. Seems messy to create
|
+ // For Win7, in_quick_launch_bar means pinning to taskbar. Use |
+ // base::PATH_START as a flag for this case. |
+ (base::win::GetVersion() >= base::win::VERSION_WIN7) ? |
+ base::PATH_START : base::DIR_APP_DATA, |
gab
2013/04/23 17:59:57
There is base::DIR_USER_QUICK_LAUNCH, no need for
calamity
2013/04/26 04:38:49
Done.
|
+ (base::win::GetVersion() >= base::win::VERSION_WIN7) ? |
+ NULL : L"Microsoft\\Internet Explorer\\Quick Launch" |
+ } |
+ }; |
+ // Populate shortcut_paths. |
+ for (int i = 0; i < arraysize(locations); ++i) { |
+ if (locations[i].use_this_location) { |
+ base::FilePath path; |
+ |
+ // Skip the Win7 case. |
+ if (locations[i].location_id == base::PATH_START) |
gab
2013/04/23 17:59:57
Remove this (see comment above).
calamity
2013/04/26 04:38:49
Done.
|
+ continue; |
+ |
+ if (!PathService::Get(locations[i].location_id, &path)) { |
+ continue; |
gab
2013/04/23 17:59:57
+
NOTREACHED();
calamity
2013/04/26 04:38:49
Done.
|
+ } |
+ |
+ if (locations[i].subdir != NULL) |
+ path = path.Append(locations[i].subdir); |
+ shortcut_paths.push_back(path); |
+ } |
+ } |
+ return shortcut_paths; |
+} |
+ |
} // namespace internals |
} // namespace web_app |