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

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: remove TODO for Notify Created 8 years, 3 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 05efc3c7c7f792a5808ab190cdb4f8e7ae76c0f0..3960974ef1bf9aefd8bd4740c9cee9ee3d80a3a6 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,46 @@ 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) {
+ // This is only meant to be called for system-level installs.
+ if (!installer_state.system_install()) {
+ NOTREACHED();
+ return;
+ }
+ BrowserDistribution* browser_dist = product.distribution();
+ 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);
+
+ 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 (!file_util::CreateDirectory(user_start_menu) ||
+ !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