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

Unified Diff: chrome/installer/setup/install.cc

Issue 10889028: Install a user-level Start Menu shortcut for every user on system-installs through Active Setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grt comments Created 8 years, 4 months 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
Index: chrome/installer/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index ffd0f2b055db97a726f85846a1b7f13a0c8d5437..b2532e5eaa2700337a16d5d2f5164b16bccabf35 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -294,7 +294,7 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts(
FilePath chrome_link(start_menu_folder_path.Append(product_name + L".lnk"));
if (create_always && !file_util::PathExists(start_menu_folder_path))
- file_util::CreateDirectoryW(start_menu_folder_path);
+ file_util::CreateDirectoryW(start_menu_folder_path);
VLOG(1) << operation << " shortcut to " << chrome_exe.value() << " at "
<< chrome_link.value();
@@ -315,6 +315,9 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts(
}
}
+ if (create_always && installer_state.system_install())
+ ForceCreateUserLevelStartMenuShortcut(installer_state, product);
+
// Create/update uninstall link if we are not an MSI install. MSI
// installations are, for the time being, managed only through the
// Add/Remove Programs dialog.
@@ -339,6 +342,44 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts(
}
}
+// TODO(gab): This is a hack that is temporarily required for the Start Menu
+// (now Start Screen) shortcut to show up on Win8. This will be removed when I'm
+// done refactoring ShellUtil as part of http://goo.gl/Az889.
+void ForceCreateUserLevelStartMenuShortcut(
+ const InstallerState& installer_state,
+ const Product& product) {
+ BrowserDistribution* browser_dist = product.distribution();
grt (UTC plus 2) 2012/09/02 14:18:19 to protect against someone accidentally calling th
gab 2012/09/02 16:15:12 Done.
+ const string16 product_name(browser_dist->GetAppShortCutName());
+ const string16 product_desc(browser_dist->GetAppDescription());
+ const FilePath chrome_exe(
+ installer_state.target_path().Append(installer::kChromeExe));
+
+ FilePath user_start_menu;
+ if (!PathService::Get(base::DIR_START_MENU, &user_start_menu)) {
+ LOG(DFATAL) << "Failed to get user-level start menu path.";
+ return;
+ }
+ user_start_menu = user_start_menu.Append(product_name);
+ // Make sure the directory exists (no need to handle the return value here
+ // as we still want to try to create the shortcut; if the directory is truly
grt (UTC plus 2) 2012/09/02 14:18:19 i find the "...as we still want to try..." part mi
gab 2012/09/02 16:15:12 Ended up deciding to wrap it in the if below. What
+ // not present the shortcut creation will fail anyways).
+ file_util::CreateDirectory(user_start_menu);
+
+ const FilePath chrome_link(
+ user_start_menu.Append(product_name + L".lnk"));
+
+ const uint32 options = (ShellUtil::SHORTCUT_CREATE_ALWAYS |
+ ShellUtil::SHORTCUT_DUAL_MODE);
+
+ VLOG(1) << "Creating shortcut to " << chrome_exe.value() << " at "
+ << chrome_link.value();
+ if (!ShellUtil::UpdateChromeShortcut(browser_dist, chrome_exe.value(),
+ chrome_link.value(), string16(), product_desc, chrome_exe.value(),
+ browser_dist->GetIconIndex(), options)) {
+ LOG(ERROR) << "Creating shortcut at " << chrome_link.value() << " failed.";
+ }
+}
+
void CreateOrUpdateDesktopAndQuickLaunchShortcuts(
const InstallerState& installer_state,
const Product& product,

Powered by Google App Engine
This is Rietveld 408576698