summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup/install_worker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/setup/install_worker.cc')
-rw-r--r--chrome/installer/setup/install_worker.cc60
1 files changed, 54 insertions, 6 deletions
diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc
index da91368..b14880f 100644
--- a/chrome/installer/setup/install_worker.cc
+++ b/chrome/installer/setup/install_worker.cc
@@ -248,12 +248,7 @@ void AddProductSpecificWorkItems(const InstallationState& original_state,
}
}
-// Adds work items that make registry adjustments for Google Update. When a
-// product is installed (including overinstall), Google Update will write the
-// channel ("ap") value into either Chrome or Chrome Frame's ClientState key.
-// In the multi-install case, this value is used as the basis upon which the
-// package's channel value is built (by adding the ordered list of installed
-// products and their options).
+// Adds work items that make registry adjustments for Google Update.
void AddGoogleUpdateWorkItems(const InstallationState& original_state,
const InstallerState& installer_state,
WorkItemList* install_list) {
@@ -289,10 +284,62 @@ void AddGoogleUpdateWorkItems(const InstallationState& original_state,
}
}
+ AddUsageStatsWorkItems(original_state, installer_state, install_list);
+
// TODO(grt): check for other keys/values we should put in the package's
// ClientState and/or Clients key.
}
+void AddUsageStatsWorkItems(const InstallationState& original_state,
+ const InstallerState& installer_state,
+ WorkItemList* install_list) {
+ DCHECK(installer_state.operation() == InstallerState::MULTI_INSTALL ||
+ installer_state.operation() == InstallerState::MULTI_UPDATE);
+
+ HKEY root_key = installer_state.root_key();
+ bool value_found = false;
+ DWORD usagestats = 0;
+ const Products& products = installer_state.products();
+
+ // Search for an existing usagestats value for any product.
+ for (Products::const_iterator scan = products.begin(), end = products.end();
+ !value_found && scan != end; ++scan) {
+ BrowserDistribution* dist = (*scan)->distribution();
+ const ProductState* product_state =
+ original_state.GetNonVersionedProductState(
+ installer_state.system_install(), dist->GetType());
+ value_found = product_state->GetUsageStats(&usagestats);
+ }
+
+ // If a value was found, write it in the appropriate location for the
+ // binaries and remove all values from the products.
+ if (value_found) {
+ std::wstring state_key(
+ installer_state.multi_package_binaries_distribution()->GetStateKey());
+ install_list->AddCreateRegKeyWorkItem(root_key, state_key);
+ install_list->AddSetRegValueWorkItem(root_key, state_key,
+ google_update::kRegUsageStatsField,
+ usagestats, false);
+
+ for (Products::const_iterator scan = products.begin(), end = products.end();
+ scan != end; ++scan) {
+ BrowserDistribution* dist = (*scan)->distribution();
+ if (installer_state.system_install()) {
+ install_list->AddDeleteRegValueWorkItem(
+ root_key, dist->GetStateMediumKey(),
+ google_update::kRegUsageStatsField);
+ // Previous versions of Chrome also wrote a value in HKCU even for
+ // system-level installs, so clean that up.
+ install_list->AddDeleteRegValueWorkItem(
+ HKEY_CURRENT_USER, dist->GetStateKey(),
+ google_update::kRegUsageStatsField);
+ }
+ install_list->AddDeleteRegValueWorkItem(root_key, dist->GetStateKey(),
+ google_update::kRegUsageStatsField);
+ }
+ }
+}
+
// This is called when an MSI installation is run. It may be that a user is
// attempting to install the MSI on top of a non-MSI managed installation.
// If so, try and remove any existing uninstallation shortcuts, as we want the
@@ -570,6 +617,7 @@ void AddInstallWorkItems(const InstallationState& original_state,
AddProductSpecificWorkItems(original_state, installer_state, setup_path,
new_version, install_list);
+ // Copy over brand, usagestats, and other values.
AddGoogleUpdateWorkItems(original_state, installer_state, install_list);
AddQuickEnableWorkItems(installer_state, original_state, &setup_path,