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

Unified Diff: chrome/installer/util/shell_util.cc

Issue 11465025: Keep installing all-users Start Menu and Desktop shortcuts on system-level installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove TODO Created 8 years 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/installer/setup/install.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index b7240e118b7913165174d34fb7feaf826017d8ef..96e1273390cd73e3ceac10e7b300d93ed79b0072 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1278,6 +1278,7 @@ bool ShellUtil::CreateOrUpdateShortcut(
system_shortcut_path = system_shortcut_path.Append(shortcut_name);
FilePath *chosen_path;
+ bool should_install_shortcut = true;
if (properties.level == SYSTEM_LEVEL) {
// Install the system-level shortcut if requested.
chosen_path = &system_shortcut_path;
@@ -1288,36 +1289,42 @@ bool ShellUtil::CreateOrUpdateShortcut(
// not to create a user-level shortcut in that case.
chosen_path = &user_shortcut_path;
} else {
- // Do not install anything if we are told to install a user-level shortcut,
- // but the system-level variant of that shortcut is present.
- chosen_path = &FilePath();
+ // Do not install any shortcut if we are told to install a user-level
+ // shortcut, but the system-level variant of that shortcut is present.
+ // Other actions (e.g., pinning) can still happen with respect to the
+ // existing system-level shortcut however.
+ chosen_path = &system_shortcut_path;
+ should_install_shortcut = false;
}
- // No shortcut needs to be created/updated.
- if (chosen_path->empty())
- return true;
-
- base::win::ShortcutOperation shortcut_operation =
- TranslateShortcutOperation(operation);
- // Make sure the parent directories exist when creating the shortcut.
- if (shortcut_operation == base::win::SHORTCUT_CREATE_ALWAYS &&
- !file_util::CreateDirectory(chosen_path->DirName())) {
+ if (chosen_path == NULL || chosen_path->empty()) {
NOTREACHED();
return false;
}
- base::win::ShortcutProperties shortcut_properties(
- TranslateShortcutProperties(properties));
- bool ret = base::win::CreateOrUpdateShortcutLink(
- *chosen_path, shortcut_properties, shortcut_operation);
+ base::win::ShortcutOperation shortcut_operation =
+ TranslateShortcutOperation(operation);
+ bool ret = true;
+ if (should_install_shortcut) {
+ // Make sure the parent directories exist when creating the shortcut.
+ if (shortcut_operation == base::win::SHORTCUT_CREATE_ALWAYS &&
+ !file_util::CreateDirectory(chosen_path->DirName())) {
+ NOTREACHED();
+ return false;
+ }
+
+ base::win::ShortcutProperties shortcut_properties(
+ TranslateShortcutProperties(properties));
+ ret = base::win::CreateOrUpdateShortcutLink(
+ *chosen_path, shortcut_properties, shortcut_operation);
+ }
if (ret && shortcut_operation == base::win::SHORTCUT_CREATE_ALWAYS &&
properties.pin_to_taskbar &&
base::win::GetVersion() >= base::win::VERSION_WIN7) {
ret = base::win::TaskbarPinShortcutLink(chosen_path->value().c_str());
if (!ret) {
- LOG(ERROR) << "The shorcut at " << chosen_path->value()
- << " was created, but the taskbar pin failed.";
+ LOG(ERROR) << "Failed to pin " << chosen_path->value();
}
}
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698