From 999df889f45992add0a6badd270daa1f43a91777 Mon Sep 17 00:00:00 2001 From: "grt@chromium.org" Date: Tue, 15 Nov 2011 01:19:16 +0000 Subject: Write the install language to the registry for user-level installs. Google Update (Omaha) will send the value up in app pings. BUG=100751 TEST=install user-level Chrome. check HKCU\Software\Google\Update\Clients\{8A69D345-D564-463c-AFF1-A69D9E530F96} for a "lang" value. Review URL: http://codereview.chromium.org/8555010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110002 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/installer/setup/chrome_frame_quick_enable.cc | 4 +++- chrome/installer/setup/install_worker.cc | 20 ++++++++++++++++++-- chrome/installer/setup/install_worker.h | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) (limited to 'chrome/installer/setup') diff --git a/chrome/installer/setup/chrome_frame_quick_enable.cc b/chrome/installer/setup/chrome_frame_quick_enable.cc index 5255086..82fc7ec 100644 --- a/chrome/installer/setup/chrome_frame_quick_enable.cc +++ b/chrome/installer/setup/chrome_frame_quick_enable.cc @@ -108,8 +108,10 @@ InstallStatus ChromeFrameQuickEnable(const InstallationState& machine_state, // This creates the uninstallation entry for GCF. AddUninstallShortcutWorkItems(*installer_state, setup_path, new_version, item_list.get(), *cf); + // Always set the "lang" value since quick-enable always happens in the + // context of an interactive session with a user. AddVersionKeyWorkItems(installer_state->root_key(), cf->distribution(), - new_version, item_list.get()); + new_version, true, item_list.get()); AddChromeFrameWorkItems(machine_state, *installer_state, setup_path, new_version, *cf, item_list.get()); diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index 1200219..7105590 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -30,6 +30,7 @@ #include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/installer_state.h" #include "chrome/installer/util/install_util.h" +#include "chrome/installer/util/l10n_string_util.h" #include "chrome/installer/util/product.h" #include "chrome/installer/util/set_reg_value_work_item.h" #include "chrome/installer/util/shell_util.h" @@ -239,6 +240,7 @@ void AddMultiUninstallWorkItems(const InstallerState& installer_state, void AddVersionKeyWorkItems(HKEY root, BrowserDistribution* dist, const Version& new_version, + bool add_language_identifier, WorkItemList* list) { // Create Version key for each distribution (if not already present) and set // the new product version as the last step. @@ -252,6 +254,17 @@ void AddVersionKeyWorkItems(HKEY root, google_update::kRegOopcrashesField, static_cast(1), false); // set during first install + if (add_language_identifier) { + // Write the language identifier of the current translation. Omaha's set of + // languages is a superset of Chrome's set of translations with this one + // exception: what Chrome calls "en-us", Omaha calls "en". sigh. + std::wstring language(GetCurrentTranslation()); + if (LowerCaseEqualsASCII(language, "en-us")) + language.resize(2); + list->AddSetRegValueWorkItem(root, version_key, + google_update::kRegLangField, language, + false); // do not overwrite language + } list->AddSetRegValueWorkItem(root, version_key, google_update::kRegVersionField, ASCIIToWide(new_version.GetString()), @@ -782,6 +795,9 @@ void AddInstallWorkItems(const InstallationState& original_state, new_version, install_list); const HKEY root = installer_state.root_key(); + // Only set "lang" for user-level installs since for system-level, the install + // language may not be related to a given user's runtime language. + const bool add_language_identifier = !installer_state.system_install(); const Products& products = installer_state.products(); for (size_t i = 0; i < products.size(); ++i) { @@ -791,7 +807,7 @@ void AddInstallWorkItems(const InstallationState& original_state, install_list, *product); AddVersionKeyWorkItems(root, product->distribution(), new_version, - install_list); + add_language_identifier, install_list); } if (installer_state.is_multi_install()) { @@ -800,7 +816,7 @@ void AddInstallWorkItems(const InstallationState& original_state, AddVersionKeyWorkItems(root, installer_state.multi_package_binaries_distribution(), new_version, - install_list); + add_language_identifier, install_list); } // Add any remaining work items that involve special settings for diff --git a/chrome/installer/setup/install_worker.h b/chrome/installer/setup/install_worker.h index 2e9dfd4..a415003 100644 --- a/chrome/installer/setup/install_worker.h +++ b/chrome/installer/setup/install_worker.h @@ -132,10 +132,12 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, const Product& product); // Create Version key for a product (if not already present) and sets the new -// product version as the last step. +// product version as the last step. If |add_language_identifier| is true, the +// "lang" value is also set according to the currently selected translation. void AddVersionKeyWorkItems(HKEY root, BrowserDistribution* dist, const Version& new_version, + bool add_language_identifier, WorkItemList* list); // Unregisters the "opv" version of ChromeLauncher from IE's low rights -- cgit v1.1