Index: chrome/installer/setup/install.cc |
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc |
index ffd0f2b055db97a726f85846a1b7f13a0c8d5437..b9f8ae48ce8004b3ce849e0ad7227128c6aee75d 100644 |
--- a/chrome/installer/setup/install.cc |
+++ b/chrome/installer/setup/install.cc |
@@ -315,6 +315,10 @@ 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 +343,40 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
} |
} |
+void ForceCreateUserLevelStartMenuShortcut( |
+ const InstallerState& installer_state, |
+ const Product& product) { |
+ 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 start_menu_user_level; |
+ if (!PathService::Get(base::DIR_START_MENU, &start_menu_user_level)) { |
+ LOG(ERROR) << "Failed to get user-level start menu path."; |
+ return; |
+ } |
+ start_menu_user_level = start_menu_user_level.Append(product_name); |
+ if (!file_util::PathExists(start_menu_user_level)) |
grt (UTC plus 2)
2012/08/29 17:07:06
no need for this check, as CreateDirectory does it
gab
2012/08/29 21:53:00
Done.
|
+ file_util::CreateDirectoryW(start_menu_user_level); |
grt (UTC plus 2)
2012/08/29 17:07:06
CreateDirectoryW -> CreateDirectory
gab
2012/08/29 21:53:00
Done.
|
+ |
+ const FilePath chrome_link( |
+ start_menu_user_level.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(WARNING) << "Creating shortcut at " << chrome_link.value() |
grt (UTC plus 2)
2012/08/29 17:07:06
WARNING -> ERROR?
gab
2012/08/29 21:53:00
Done.
|
+ << " failed."; |
+ } |
+} |
+ |
void CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
const InstallerState& installer_state, |
const Product& product, |