diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 01:19:16 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 01:19:16 +0000 |
commit | 999df889f45992add0a6badd270daa1f43a91777 (patch) | |
tree | f4ff0c74faabe54ecd3d11402cfa235e7f0f16d4 /chrome/installer | |
parent | 7b2db2e2cf46fcd0d01d9449b0245859d20144b1 (diff) | |
download | chromium_src-999df889f45992add0a6badd270daa1f43a91777.zip chromium_src-999df889f45992add0a6badd270daa1f43a91777.tar.gz chromium_src-999df889f45992add0a6badd270daa1f43a91777.tar.bz2 |
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
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/chrome_frame_quick_enable.cc | 4 | ||||
-rw-r--r-- | chrome/installer/setup/install_worker.cc | 20 | ||||
-rw-r--r-- | chrome/installer/setup/install_worker.h | 4 | ||||
-rw-r--r-- | chrome/installer/util/l10n_string_util.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/l10n_string_util.h | 5 |
5 files changed, 32 insertions, 5 deletions
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<DWORD>(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 diff --git a/chrome/installer/util/l10n_string_util.cc b/chrome/installer/util/l10n_string_util.cc index 8a51868..4c7426b 100644 --- a/chrome/installer/util/l10n_string_util.cc +++ b/chrome/installer/util/l10n_string_util.cc @@ -78,4 +78,8 @@ std::wstring GetLocalizedEulaResource() { return url_path; } +std::wstring GetCurrentTranslation() { + return GetLanguageSelector().selected_translation(); +} + } // namespace installer diff --git a/chrome/installer/util/l10n_string_util.h b/chrome/installer/util/l10n_string_util.h index e4420d9..27ee239 100644 --- a/chrome/installer/util/l10n_string_util.h +++ b/chrome/installer/util/l10n_string_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -27,6 +27,9 @@ std::wstring GetLocalizedString(int base_message_id); // The empty string is returned on failure. std::wstring GetLocalizedEulaResource(); +// Returns the language identifier of the translation currently in use. +std::wstring GetCurrentTranslation(); + } // namespace installer. #endif // CHROME_INSTALLER_UTIL_L10N_STRING_UTIL_H_ |