Index: chrome/installer/setup/install_worker.cc |
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc |
index 5450e32947b91e6495cd6d54f93d1a996e69c3ea..c6bfa6361581400db4aaecd395cb46aae73b07b5 100644 |
--- a/chrome/installer/setup/install_worker.cc |
+++ b/chrome/installer/setup/install_worker.cc |
@@ -29,6 +29,7 @@ |
#include "base/win/windows_version.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/installer/launcher_support/chrome_launcher_support.h" |
#include "chrome/installer/setup/install.h" |
#include "chrome/installer/setup/setup_constants.h" |
#include "chrome/installer/setup/setup_util.h" |
@@ -179,34 +180,28 @@ void AddInstallerCopyTasks(const InstallerState& installer_state, |
WorkItem::ALWAYS); |
} |
- // If only the App Host (not even the Chrome Binaries) is being installed, |
- // this must be a user-level App Host piggybacking on system-level Chrome |
- // Binaries. Only setup.exe is required, and only for uninstall. |
- if (installer_state.products().size() != 1 || |
- !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
- base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); |
- if (archive_path != archive_dst) { |
- // In the past, we copied rather than moved for system level installs so |
- // that the permissions of %ProgramFiles% would be picked up. Now that |
- // |temp_path| is in %ProgramFiles% for system level installs (and in |
- // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. |
- // Setup.exe, on the other hand, is created elsewhere so it must always be |
- // copied. |
- if (temp_path.IsParent(archive_path)) { |
- install_list->AddMoveTreeWorkItem(archive_path.value(), |
- archive_dst.value(), |
- temp_path.value(), |
- WorkItem::ALWAYS_MOVE); |
- } else { |
- // This may occur when setup is run out of an existing installation |
- // directory. For example, when quick-enabling user-level App Launcher |
- // from system-level Binaries. We can't (and don't want to) remove the |
- // system-level archive. |
- install_list->AddCopyTreeWorkItem(archive_path.value(), |
- archive_dst.value(), |
- temp_path.value(), |
- WorkItem::ALWAYS); |
- } |
+ base::FilePath archive_dst(installer_dir.Append(archive_path.BaseName())); |
+ if (archive_path != archive_dst) { |
+ // In the past, we copied rather than moved for system level installs so |
+ // that the permissions of %ProgramFiles% would be picked up. Now that |
+ // |temp_path| is in %ProgramFiles% for system level installs (and in |
+ // %LOCALAPPDATA% otherwise), there is no need to do this for the archive. |
+ // Setup.exe, on the other hand, is created elsewhere so it must always be |
+ // copied. |
+ if (temp_path.IsParent(archive_path)) { |
+ install_list->AddMoveTreeWorkItem(archive_path.value(), |
+ archive_dst.value(), |
+ temp_path.value(), |
+ WorkItem::ALWAYS_MOVE); |
+ } else { |
+ // This may occur when setup is run out of an existing installation |
+ // directory. For example, when quick-enabling user-level App Launcher |
+ // from system-level Binaries. We can't (and don't want to) remove the |
+ // system-level archive. |
+ install_list->AddCopyTreeWorkItem(archive_path.value(), |
+ archive_dst.value(), |
+ temp_path.value(), |
+ WorkItem::ALWAYS); |
} |
} |
} |
@@ -266,7 +261,7 @@ void AddInstallAppCommandWorkItems(const InstallerState& installer_state, |
DCHECK(product.is_chrome_app_host()); |
AddCommandWithParameterWorkItems(installer_state, machine_state, new_version, |
product, kCmdInstallApp, |
- installer::kChromeAppHostExe, |
+ installer::kChromeExe, |
::switches::kInstallFromWebstore, |
work_item_list); |
} |
@@ -362,7 +357,6 @@ void AddQuickEnableApplicationLauncherWorkItems( |
new_version)); |
// kMultiInstall and kVerboseLogging were processed above. |
cmd_line.AppendSwitch(switches::kChromeAppLauncher); |
- cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent); |
gab
2013/04/29 20:25:41
Why is this being removed?
huangs
2013/04/30 14:01:49
This existed so an orphaned app_host.exe (i.e., it
|
AppCommand cmd(cmd_line.GetCommandLineString()); |
cmd.set_sends_pings(true); |
cmd.set_is_web_accessible(true); |
@@ -661,6 +655,38 @@ void CleanupBadCanaryDelegateExecuteRegistration( |
} |
} |
+// As of M28, App Launcher is unified with Chrome. Here we delete a number of |
+// legacy install artifacts for the product, before new artifacts are installed. |
+void MigrateLegacyAppLauncher(const InstallerState& installer_state, |
+ const base::FilePath& temp_path, |
+ WorkItemList* install_list) { |
+ VLOG(1) << "Migrating legacy App Launcher with app_host.exe."; |
+ HKEY reg_root = HKEY_CURRENT_USER; |
+ BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( |
+ BrowserDistribution::CHROME_APP_HOST); |
+ |
+ // Delete Add/Remove entry. |
+ string16 legacy_app_host_uninstall_reg_path( |
+ L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" |
+ L"Google Chrome App Launcher"); |
gab
2013/04/29 20:25:41
Where was this set from before? Does it have to be
huangs
2013/04/30 14:01:49
This obsolete key was living in chrome_app_host_di
|
+ install_list->AddDeleteRegKeyWorkItem(reg_root, |
+ legacy_app_host_uninstall_reg_path); |
+ |
+ if (installer_state.system_install()) { |
+ // Delete user-level registry entries for App Launcher. |
+ install_list->AddDeleteRegKeyWorkItem(reg_root, dist->GetVersionKey()); |
+ install_list->AddDeleteRegKeyWorkItem(reg_root, dist->GetStateKey()); |
+ // Not updating AP values |
+ } |
+ |
+ // Delete app_host.exe. |
+ base::FilePath app_host_exe(chrome_launcher_support::GetAnyAppHostPath()); |
gab
2013/04/29 20:25:41
This will always prefer deleting the system-level
huangs
2013/04/30 14:01:49
Yes, but app_host.exe have always been in user-lev
|
+ if (!app_host_exe.empty()) |
+ install_list->AddDeleteTreeWorkItem(app_host_exe, temp_path); |
+ |
+ // Not migrating shortcuts here. |
+} |
+ |
} // namespace |
// This method adds work items to create (or update) Chrome uninstall entry in |
@@ -1173,6 +1199,18 @@ void AddInstallWorkItems(const InstallationState& original_state, |
install_list->AddCreateDirWorkItem(temp_path); |
install_list->AddCreateDirWorkItem(target_path); |
+ // User-level App Launcher may be an old version that uses app_host.exe, |
+ // which needs to be migrated. |
+ if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES) && |
+ !installer_state.system_install()) { |
+ const ProductState* orig_product = original_state.GetProductState( |
+ false, BrowserDistribution::CHROME_APP_HOST); |
+ if (orig_product && |
+ chrome_launcher_support::HasLegacyAppHostExe(orig_product->version())) { |
+ MigrateLegacyAppLauncher(installer_state, temp_path, install_list); |
+ } |
+ } |
+ |
if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) || |
installer_state.FindProduct(BrowserDistribution::CHROME_FRAME) || |
installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
@@ -1187,15 +1225,6 @@ void AddInstallWorkItems(const InstallationState& original_state, |
install_list); |
} |
- if (installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
- install_list->AddCopyTreeWorkItem( |
- src_path.Append(installer::kChromeAppHostExe).value(), |
- target_path.Append(installer::kChromeAppHostExe).value(), |
- temp_path.value(), |
- WorkItem::ALWAYS, |
- L""); |
- } |
- |
// Copy installer in install directory |
AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, |
new_version, install_list); |