Index: chrome/browser/profiles/profile_shortcut_manager_win.cc |
=================================================================== |
--- chrome/browser/profiles/profile_shortcut_manager_win.cc (revision 176381) |
+++ chrome/browser/profiles/profile_shortcut_manager_win.cc (working copy) |
@@ -199,6 +199,20 @@ |
if (!file_util::PathExists(old_shortcut_path)) |
return; |
+ // If a system shortcut exists at the destination, then simply delete the |
+ // old shortcut. |
+ FilePath system_shortcuts_directory; |
+ DCHECK(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
gab
2013/01/14 21:49:30
Take the call out of the DCHECK, store the result
Alexei Svitkine (slow)
2013/01/15 22:03:02
Doh, thanks for catching this. Fixed.
|
+ BrowserDistribution::GetDistribution(), |
+ ShellUtil::SYSTEM_LEVEL, |
+ &system_shortcuts_directory)); |
+ const FilePath possible_system_shortcut = |
sail
2013/01/14 21:45:19
new_system_shortcut_path
Alexei Svitkine (slow)
2013/01/15 22:03:02
I've changed it to |possible_new_system_shortcut|,
|
+ system_shortcuts_directory.Append(new_shortcut_file); |
+ if (file_util::PathExists(possible_system_shortcut)) { |
+ file_util::Delete(old_shortcut_path, false); |
+ return; |
+ } |
+ |
FilePath new_shortcut_path = shortcuts_directory.Append(new_shortcut_file); |
sail
2013/01/14 21:45:19
new_user_shortcut_path
Alexei Svitkine (slow)
2013/01/15 22:03:02
All the paths here are assumed to be user paths ex
|
if (!file_util::Move(old_shortcut_path, new_shortcut_path)) |
LOG(ERROR) << "Could not rename Windows profile desktop shortcut."; |
@@ -262,7 +276,7 @@ |
profiles::internal::GetShortcutFilenameForProfile(profile_name, |
distribution); |
shortcuts.push_back(FilePath(shortcut_name)); |
- operation = ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS; |
+ operation = ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL; |
gab
2013/01/14 21:49:30
This will prevent creation of all profile shortcut
Alexei Svitkine (slow)
2013/01/14 22:57:14
Makes sense. Just to clarify, SHELL_SHORTCUT_CREAT
gab
2013/01/14 23:04:42
Ah, you're right, I wrongly assumed it would preve
Alexei Svitkine (slow)
2013/01/15 22:03:02
Done.
|
} |
for (size_t i = 0; i < shortcuts.size(); ++i) { |
@@ -340,9 +354,9 @@ |
properties.set_shortcut_name( |
profiles::internal::GetShortcutFilenameForProfile(string16(), |
distribution)); |
- ShellUtil::CreateOrUpdateShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
- distribution, properties, |
- ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); |
+ ShellUtil::CreateOrUpdateShortcut( |
+ ShellUtil::SHORTCUT_LOCATION_DESKTOP, distribution, properties, |
+ ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL); |
} |
} |