Index: chrome/installer/setup/install_worker.cc |
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc |
index 2b544b6322eb45709f7a19d29277a980ca0c6223..9f3b8454af8f41e83088e5e6a0c01bd82d04bfa1 100644 |
--- a/chrome/installer/setup/install_worker.cc |
+++ b/chrome/installer/setup/install_worker.cc |
@@ -28,6 +28,7 @@ |
#include "base/win/windows_version.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/installer/setup/app_launcher_installer.h" |
#include "chrome/installer/setup/install.h" |
#include "chrome/installer/setup/setup_constants.h" |
#include "chrome/installer/setup/setup_util.h" |
@@ -46,7 +47,6 @@ |
#include "chrome/installer/util/product.h" |
#include "chrome/installer/util/set_reg_value_work_item.h" |
#include "chrome/installer/util/shell_util.h" |
-#include "chrome/installer/util/updating_app_registration_data.h" |
#include "chrome/installer/util/util_constants.h" |
#include "chrome/installer/util/work_item_list.h" |
@@ -73,11 +73,6 @@ const wchar_t kIELowRightsPolicyOldGuid[] = |
const wchar_t kElevationPolicyKeyPath[] = |
L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; |
-// The legacy command ids for installing an application or extension. These are |
-// only here so they can be removed from the registry. |
-const wchar_t kLegacyCmdInstallApp[] = L"install-application"; |
-const wchar_t kLegacyCmdInstallExtension[] = L"install-extension"; |
- |
void GetOldIELowRightsElevationPolicyKeyPath(base::string16* key_path) { |
key_path->assign(kElevationPolicyKeyPath, |
arraysize(kElevationPolicyKeyPath) - 1); |
@@ -155,34 +150,29 @@ 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); |
- } |
+ // TODO(huangs): remove the following comments (after review). |
+ // Reverting https://chromiumcodereview.appspot.com/11412015 |
+ // but keeping https://chromiumcodereview.appspot.com/12051069 |
+ 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. We cannot remove the system-level archive. |
+ install_list->AddCopyTreeWorkItem(archive_path.value(), |
+ archive_dst.value(), |
+ temp_path.value(), |
+ WorkItem::ALWAYS); |
} |
} |
} |
@@ -232,18 +222,6 @@ void AddCommandWithParameterWorkItems(const InstallerState& installer_state, |
} |
} |
-void AddLegacyAppCommandRemovalItem(const InstallerState& installer_state, |
- const AppRegistrationData& reg_data, |
- const wchar_t* name, |
- WorkItemList* work_item_list) { |
- // These failures are ignored because this is a clean-up operation that |
- // shouldn't block an install or update on failing. |
- work_item_list->AddDeleteRegKeyWorkItem( |
- installer_state.root_key(), |
- GetRegistrationDataCommandKey(reg_data, name), |
- KEY_WOW64_32KEY)->set_ignore_failure(true); |
-} |
- |
// A callback invoked by |work_item| that adds firewall rules for Chrome. Rules |
// are left in-place on rollback unless |remove_on_rollback| is true. This is |
// the case for new installs only. Updates and overinstalls leave the rule |
@@ -292,92 +270,6 @@ void AddFirewallRulesWorkItems(const InstallerState& installer_state, |
is_new_install)); |
} |
-// Returns the basic CommandLine to setup.exe for a quick-enable operation on |
-// the binaries. This will unconditionally include --multi-install as well as |
-// --verbose-logging if the current installation was launched with |
-// --verbose-logging. |setup_path| and |new_version| are optional only when |
-// the operation is an uninstall. |
-CommandLine GetGenericQuickEnableCommand( |
- const InstallerState& installer_state, |
- const InstallationState& machine_state, |
- const base::FilePath& setup_path, |
- const Version& new_version) { |
- // Only valid for multi-install operations. |
- DCHECK(installer_state.is_multi_install()); |
- // Only valid when Chrome Binaries aren't being uninstalled. |
- DCHECK(installer_state.operation() != InstallerState::UNINSTALL || |
- !installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)); |
- // setup_path and new_version are required when not uninstalling. |
- DCHECK(installer_state.operation() == InstallerState::UNINSTALL || |
- (!setup_path.empty() && new_version.IsValid())); |
- |
- // The path to setup.exe contains the version of the Chrome Binaries, so it |
- // takes a little work to get it right. |
- base::FilePath binaries_setup_path; |
- if (installer_state.operation() == InstallerState::UNINSTALL) { |
- // One or more products are being uninstalled, but not Chrome Binaries. |
- // Use the path to the currently installed Chrome Binaries' setup.exe. |
- const ProductState* product_state = machine_state.GetProductState( |
- installer_state.system_install(), |
- BrowserDistribution::CHROME_BINARIES); |
- DCHECK(product_state); |
- binaries_setup_path = product_state->uninstall_command().GetProgram(); |
- } else { |
- // Chrome Binaries are being installed, updated, or otherwise operated on. |
- // Use the path to the given |setup_path| in the normal location of |
- // multi-install Chrome Binaries of the given |version|. |
- binaries_setup_path = installer_state.GetInstallerDirectory(new_version) |
- .Append(setup_path.BaseName()); |
- } |
- DCHECK(!binaries_setup_path.empty()); |
- |
- CommandLine cmd_line(binaries_setup_path); |
- cmd_line.AppendSwitch(switches::kMultiInstall); |
- if (installer_state.verbose_logging()) |
- cmd_line.AppendSwitch(switches::kVerboseLogging); |
- return cmd_line; |
-} |
- |
-// Adds work items to add the "quick-enable-application-host" command to the |
-// multi-installer binaries' version key on the basis of the current operation |
-// (represented in |installer_state|) and the pre-existing machine configuration |
-// (represented in |machine_state|). |
-void AddQuickEnableApplicationLauncherWorkItems( |
- const InstallerState& installer_state, |
- const InstallationState& machine_state, |
- const base::FilePath& setup_path, |
- const Version& new_version, |
- WorkItemList* work_item_list) { |
- DCHECK(work_item_list); |
- |
- bool will_have_chrome_binaries = |
- WillProductBePresentAfterSetup(installer_state, machine_state, |
- BrowserDistribution::CHROME_BINARIES); |
- |
- // For system-level binaries there is no way to keep the command state in sync |
- // with the installation/uninstallation of the Application Launcher (which is |
- // always at user-level). So we do not try to remove the command, i.e., it |
- // will always be installed if the Chrome Binaries are installed. |
- if (will_have_chrome_binaries) { |
- base::string16 cmd_key( |
- GetRegCommandKey(BrowserDistribution::GetSpecificDistribution( |
- BrowserDistribution::CHROME_BINARIES), |
- kCmdQuickEnableApplicationHost)); |
- CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state, |
- machine_state, |
- setup_path, |
- new_version)); |
- // kMultiInstall and kVerboseLogging were processed above. |
- cmd_line.AppendSwitch(switches::kChromeAppLauncher); |
- cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent); |
- AppCommand cmd(cmd_line.GetCommandLineString()); |
- cmd.set_sends_pings(true); |
- cmd.set_is_web_accessible(true); |
- cmd.set_is_run_as_user(true); |
- cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); |
- } |
-} |
- |
void AddProductSpecificWorkItems(const InstallationState& original_state, |
const InstallerState& installer_state, |
const base::FilePath& setup_path, |
@@ -393,27 +285,11 @@ void AddProductSpecificWorkItems(const InstallationState& original_state, |
list); |
AddFirewallRulesWorkItems( |
installer_state, p.distribution(), is_new_install, list); |
- AddLegacyAppCommandRemovalItem( |
- installer_state, |
- p.distribution()->GetAppRegistrationData(), |
- kLegacyCmdInstallExtension, |
- list); |
- |
- if (p.distribution()->AppHostIsSupported()) { |
- // Unconditionally remove the "install-application" command from the app |
- // hosts's key. |
- UpdatingAppRegistrationData app_launcher_reg_data( |
- installer::kAppLauncherGuid); |
- AddLegacyAppCommandRemovalItem(installer_state, app_launcher_reg_data, |
- kLegacyCmdInstallApp, list); |
- } |
} |
if (p.is_chrome_binaries()) { |
AddQueryEULAAcceptanceWorkItems( |
installer_state, setup_path, new_version, p, list); |
AddQuickEnableChromeFrameWorkItems(installer_state, list); |
- AddQuickEnableApplicationLauncherWorkItems( |
- installer_state, original_state, setup_path, new_version, list); |
} |
} |
} |
@@ -1271,14 +1147,13 @@ 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""); |
+#if defined(GOOGLE_CHROME_BUILD) |
grt (UTC plus 2)
2015/01/08 21:41:49
these two conditions sprinkled here and there is a
huangs
2015/01/18 01:18:24
Ack. Though I think it might be useful for these l
|
+ if (!InstallUtil::IsChromeSxSProcess()) { |
+ // Unconditionally remove the legacy app_host.exe. |
+ app_launcher_installer::AddRemoveLegacyAppHostExeWorkItems( |
+ target_path, temp_path, install_list); |
} |
+#endif |
// Copy installer in install directory |
AddInstallerCopyTasks(installer_state, setup_path, archive_path, temp_path, |
@@ -1312,24 +1187,20 @@ void AddInstallWorkItems(const InstallationState& original_state, |
install_list); |
} |
- // TODO(huangs): Implement actual migration code and remove the hack below. |
- // If installing Chrome without the legacy stand-alone App Launcher (to be |
- // handled later), add "shadow" App Launcher registry keys so Google Update |
- // would recognize the "dr" value in the App Launcher ClientState key. |
- // Checking .is_multi_install() excludes Chrome Canary and stand-alone Chrome. |
- if (installer_state.is_multi_install() && |
- installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER) && |
- !installer_state.FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
- BrowserDistribution* shadow_app_launcher_dist = |
- BrowserDistribution::GetSpecificDistribution( |
- BrowserDistribution::CHROME_APP_HOST); |
- AddVersionKeyWorkItems(root, |
- shadow_app_launcher_dist->GetVersionKey(), |
- shadow_app_launcher_dist->GetDisplayName(), |
- new_version, |
- add_language_identifier, |
- install_list); |
+#if defined(GOOGLE_CHROME_BUILD) |
+ if (!InstallUtil::IsChromeSxSProcess()) { |
+ app_launcher_installer::AddRemoveLegacyAppCommandsWorkItems( |
+ installer_state, install_list); |
+ |
+ // For Chrome, add "shadow" App Launcher Client keys so Google Update can |
+ // recognize the "dr" value in the App Launcher ClientState key. |
+ // Checking .is_multi_install() excludes Chrome Canary and Chromium. |
+ if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { |
grt (UTC plus 2)
2015/01/08 21:41:49
the is_chrome() block of AddProductSpecificWorkIte
huangs
2015/01/18 01:18:24
I suppose, but this would require |add_language_id
grt (UTC plus 2)
2015/01/20 21:30:22
Sure. While you're at it, please change the commen
huangs
2015/01/20 23:26:00
Done.
|
+ app_launcher_installer::AddAppLauncherVersionKeyWorkItems( |
+ root, new_version, add_language_identifier, install_list); |
+ } |
} |
+#endif |
grt (UTC plus 2)
2015/01/08 21:41:49
#endif // GOOGLE_CHROME_BUILD
here and elsewhere
huangs
2015/01/18 01:18:24
Done.
|
// Add any remaining work items that involve special settings for |
// each product. |