Index: chrome/installer/setup/install.cc |
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc |
index bd7ab6ff49ef95e607eb51f31d95e09e4a8cae39..6428c581ba4cd9da69bb252048569fd90234182e 100644 |
--- a/chrome/installer/setup/install.cc |
+++ b/chrome/installer/setup/install.cc |
@@ -256,11 +256,12 @@ bool CreateVisualElementsManifest(const FilePath& src_path, |
} |
} |
-void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
+bool CreateOrUpdateStartMenuAndTaskbarShortcuts( |
const InstallerState& installer_state, |
const FilePath& setup_exe, |
const Product& product, |
uint32 options) { |
+ bool is_successful = true; |
gab
2012/08/30 20:26:27
nit: We try to avoid is_* in chromium. Please rena
huangs
2012/08/30 20:46:31
Done.
|
// TODO(tommi): Change this function to use WorkItemList. |
DCHECK(product.is_chrome()); |
@@ -282,7 +283,7 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
base::DIR_COMMON_START_MENU : base::DIR_START_MENU; |
if (!PathService::Get(dir_enum, &start_menu_folder_path)) { |
LOG(ERROR) << "Failed to get start menu path."; |
- return; |
+ return false; |
} |
start_menu_folder_path = start_menu_folder_path.Append(product_name); |
@@ -303,6 +304,7 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
browser_dist->GetIconIndex(), options)) { |
LOG(WARNING) << operation << " shortcut at " << chrome_link.value() |
<< " failed."; |
+ is_successful = false; |
} else if (create_always && |
base::win::GetVersion() >= base::win::VERSION_WIN7) { |
// If the Start Menu shortcut was successfully created and |create_always|, |
@@ -313,6 +315,7 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
LOG(ERROR) << "Failed to pin shortcut to taskbar: " |
<< chrome_link.value(); |
} |
+ is_successful = false; |
} |
// Create/update uninstall link if we are not an MSI install. MSI |
@@ -335,14 +338,17 @@ void CreateOrUpdateStartMenuAndTaskbarShortcuts( |
file_util::SHORTCUT_NO_OPTIONS)) { |
LOG(WARNING) << operation << " uninstall link at " |
<< uninstall_link.value() << " failed."; |
+ is_successful = false; |
} |
} |
+ return is_successful; |
} |
-void CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
+bool CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
const InstallerState& installer_state, |
const Product& product, |
uint32 options) { |
+ bool is_successful = true; |
gab
2012/08/30 20:26:28
nit: same here
huangs
2012/08/30 20:46:31
Done.
|
// TODO(tommi): Change this function to use WorkItemList. |
DCHECK(product.is_chrome()); |
@@ -371,6 +377,7 @@ void CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
desktop_level, options)) { |
LOG(WARNING) << operation << " desktop shortcut for " << chrome_exe.value() |
<< " failed."; |
+ is_successful = false; |
} |
VLOG(1) << operation << " quick launch shortcut for " << chrome_exe.value(); |
@@ -378,7 +385,9 @@ void CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
browser_dist, chrome_exe.value(), quick_launch_levels, options)) { |
LOG(WARNING) << operation << " quick launch shortcut for " |
<< chrome_exe.value() << " failed."; |
+ is_successful = false; |
} |
+ return is_successful; |
} |
void RegisterChromeOnMachine(const InstallerState& installer_state, |
@@ -552,4 +561,27 @@ InstallStatus InstallOrUpdateProduct( |
return result; |
} |
+bool HandleOsUpgradeForBrowser(const InstallerState& installer_state, |
+ const Product& chrome, |
+ const FilePath& setup_exe) { |
+ DCHECK(chrome.is_chrome()); |
+ bool is_successful = true; |
gab
2012/08/30 20:26:28
nit: and here
huangs
2012/08/30 20:46:31
Done.
|
+ // Upon upgrading to Windows 8, we need to fix Chrome shortcuts and register |
+ // Chrome, so that Metro Chrome would work if Chrome is the default browser. |
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
+ VLOG(1) << "Updating and registering shortcuts."; |
+ uint32 shortcut_options = ShellUtil::SHORTCUT_DUAL_MODE; |
+ if (!CreateOrUpdateDesktopAndQuickLaunchShortcuts( |
+ installer_state, chrome, shortcut_options)) { |
+ is_successful = false; |
+ } |
+ if (!CreateOrUpdateStartMenuAndTaskbarShortcuts( |
gab
2012/08/30 20:26:28
Unify the ifs, i.e. if (!1 || !2 || !3) {}
huangs
2012/08/30 20:46:31
Discussed: Doing success = fun() && success; inste
|
+ installer_state, setup_exe, chrome, shortcut_options)) { |
+ is_successful = false; |
+ } |
+ RegisterChromeOnMachine(installer_state, chrome, false); |
gab
2012/08/30 20:26:28
Add this call to the list of possible failures too
|
+ } |
+ return is_successful; |
+} |
+ |
} // namespace installer |