diff options
author | huangs@chromium.org <huangs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-08 13:59:44 +0000 |
---|---|---|
committer | huangs@chromium.org <huangs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-08 13:59:44 +0000 |
commit | ecce528ba3b2b52f2467f5248903459dcfb97357 (patch) | |
tree | 3762e251d04dd858af7a23bdc4fc0df307539379 /chrome/installer | |
parent | 1e07d782b9f404edd95c70401ea650bc63225ca2 (diff) | |
download | chromium_src-ecce528ba3b2b52f2467f5248903459dcfb97357.zip chromium_src-ecce528ba3b2b52f2467f5248903459dcfb97357.tar.gz chromium_src-ecce528ba3b2b52f2467f5248903459dcfb97357.tar.bz2 |
Installer refactoring: using string16 instead of wstring for GoogleUpdateSettings.
BUG=297647
Review URL: https://codereview.chromium.org/371753002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281740 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/gcapi/gcapi.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 58 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.h | 22 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings_unittest.cc | 74 | ||||
-rw-r--r-- | chrome/installer/util/language_selector.cc | 3 |
5 files changed, 81 insertions, 80 deletions
diff --git a/chrome/installer/gcapi/gcapi.cc b/chrome/installer/gcapi/gcapi.cc index 3d73af0..0606988 100644 --- a/chrome/installer/gcapi/gcapi.cc +++ b/chrome/installer/gcapi/gcapi.cc @@ -602,7 +602,7 @@ int __stdcall GoogleChromeDaysSinceLastRun() { kChromeRegClientStateKey, KEY_QUERY_VALUE | KEY_WOW64_32KEY); if (client_state.Valid()) { - std::wstring last_run; + base::string16 last_run; int64 last_run_value = 0; if (client_state.ReadValue(google_update::kRegLastRunTimeField, &last_run) == ERROR_SUCCESS && @@ -715,7 +715,7 @@ BOOL __stdcall CanOfferRelaunch(const wchar_t** partner_brandcode_list, // b) the installed brandcode should belong to that partner (in // brandcode_list); - std::wstring installed_brandcode; + base::string16 installed_brandcode; bool valid_brandcode = false; if (GoogleUpdateSettings::GetBrand(&installed_brandcode)) { for (int i = 0; i < partner_brandcode_list_length; ++i) { diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 94b7994..81e33ed 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -5,7 +5,6 @@ #include "chrome/installer/util/google_update_settings.h" #include <algorithm> -#include <string> #include "base/command_line.h" #include "base/files/file_path.h" @@ -53,9 +52,9 @@ GoogleUpdateSettings::kDefaultUpdatePolicy = namespace { -bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { +bool ReadGoogleUpdateStrKey(const wchar_t* const name, base::string16* value) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring reg_path = dist->GetStateKey(); + base::string16 reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WOW64_32KEY); if (key.ReadValue(name, value) != ERROR_SUCCESS) { RegKey hklm_key( @@ -72,8 +71,7 @@ bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { bool WriteGoogleUpdateStrKeyInternal(const AppRegistrationData& app_reg_data, bool system_install, const wchar_t* const name, - // presubmit: allow wstring - const std::wstring& value, + const base::string16& value, const wchar_t* const aggregate) { const REGSAM kAccess = KEY_SET_VALUE | KEY_WOW64_32KEY; if (system_install) { @@ -81,7 +79,7 @@ bool WriteGoogleUpdateStrKeyInternal(const AppRegistrationData& app_reg_data, // Machine installs require each OS user to write a unique key under a // named key in HKLM as well as an "aggregation" function that describes // how the values of multiple users are to be combined. - std::wstring uniquename; // presubmit: allow wstring + base::string16 uniquename; if (!base::win::GetUserSidString(&uniquename)) { NOTREACHED(); return false; @@ -101,7 +99,7 @@ bool WriteGoogleUpdateStrKeyInternal(const AppRegistrationData& app_reg_data, } bool WriteGoogleUpdateStrKey(const wchar_t* const name, - const std::wstring& value) { + const base::string16& value) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); return WriteGoogleUpdateStrKeyInternal( dist->GetAppRegistrationData(), false, name, value, NULL); @@ -109,11 +107,11 @@ bool WriteGoogleUpdateStrKey(const wchar_t* const name, bool ClearGoogleUpdateStrKey(const wchar_t* const name) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring reg_path = dist->GetStateKey(); + base::string16 reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE | KEY_WOW64_32KEY); - std::wstring value; + base::string16 value; if (key.ReadValue(name, &value) != ERROR_SUCCESS) return false; return (key.WriteValue(name, L"") == ERROR_SUCCESS); @@ -121,7 +119,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) { bool RemoveGoogleUpdateStrKey(const wchar_t* const name) { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring reg_path = dist->GetStateKey(); + base::string16 reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE | KEY_WOW64_32KEY); @@ -281,7 +279,7 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install, // Write to ClientStateMedium for system-level; ClientState otherwise. HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; - std::wstring reg_path = + base::string16 reg_path = system_install ? dist->GetStateMediumKey() : dist->GetStateKey(); RegKey key; LONG result = key.Create( @@ -299,15 +297,15 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install, } bool GoogleUpdateSettings::GetMetricsId(std::string* metrics_id) { - std::wstring metrics_id_w; - bool rv = ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id_w); - *metrics_id = base::WideToUTF8(metrics_id_w); + base::string16 metrics_id16; + bool rv = ReadGoogleUpdateStrKey(google_update::kRegMetricsId, &metrics_id16); + *metrics_id = base::UTF16ToUTF8(metrics_id16); return rv; } bool GoogleUpdateSettings::SetMetricsId(const std::string& metrics_id) { - std::wstring metrics_id_w = base::UTF8ToWide(metrics_id); - return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id_w); + base::string16 metrics_id16 = base::UTF8ToUTF16(metrics_id); + return WriteGoogleUpdateStrKey(google_update::kRegMetricsId, metrics_id16); } // EULA consent is only relevant for system-level installs. @@ -318,7 +316,7 @@ bool GoogleUpdateSettings::SetEULAConsent( DCHECK(dist); const DWORD eula_accepted = consented ? 1 : 0; const REGSAM kAccess = KEY_SET_VALUE | KEY_WOW64_32KEY; - std::wstring reg_path = dist->GetStateMediumKey(); + base::string16 reg_path = dist->GetStateMediumKey(); bool succeeded = true; RegKey key; @@ -351,7 +349,7 @@ bool GoogleUpdateSettings::SetEULAConsent( } int GoogleUpdateSettings::GetLastRunTime() { - std::wstring time_s; + base::string16 time_s; if (!ReadGoogleUpdateStrKey(google_update::kRegLastRunTimeField, &time_s)) return -1; int64 time_i; @@ -372,32 +370,32 @@ bool GoogleUpdateSettings::RemoveLastRunTime() { return RemoveGoogleUpdateStrKey(google_update::kRegLastRunTimeField); } -bool GoogleUpdateSettings::GetBrowser(std::wstring* browser) { +bool GoogleUpdateSettings::GetBrowser(base::string16* browser) { return ReadGoogleUpdateStrKey(google_update::kRegBrowserField, browser); } -bool GoogleUpdateSettings::GetLanguage(std::wstring* language) { +bool GoogleUpdateSettings::GetLanguage(base::string16* language) { return ReadGoogleUpdateStrKey(google_update::kRegLangField, language); } -bool GoogleUpdateSettings::GetBrand(std::wstring* brand) { +bool GoogleUpdateSettings::GetBrand(base::string16* brand) { return ReadGoogleUpdateStrKey(google_update::kRegRLZBrandField, brand); } -bool GoogleUpdateSettings::GetReactivationBrand(std::wstring* brand) { +bool GoogleUpdateSettings::GetReactivationBrand(base::string16* brand) { return ReadGoogleUpdateStrKey(google_update::kRegRLZReactivationBrandField, brand); } -bool GoogleUpdateSettings::GetClient(std::wstring* client) { +bool GoogleUpdateSettings::GetClient(base::string16* client) { return ReadGoogleUpdateStrKey(google_update::kRegClientField, client); } -bool GoogleUpdateSettings::SetClient(const std::wstring& client) { +bool GoogleUpdateSettings::SetClient(const base::string16& client) { return WriteGoogleUpdateStrKey(google_update::kRegClientField, client); } -bool GoogleUpdateSettings::GetReferral(std::wstring* referral) { +bool GoogleUpdateSettings::GetReferral(base::string16* referral) { return ReadGoogleUpdateStrKey(google_update::kRegReferralField, referral); } @@ -439,14 +437,14 @@ bool GoogleUpdateSettings::GetChromeChannelAndModifiers( void GoogleUpdateSettings::UpdateInstallStatus(bool system_install, installer::ArchiveType archive_type, int install_return_code, - const std::wstring& product_guid) { + const base::string16& product_guid) { DCHECK(archive_type != installer::UNKNOWN_ARCHIVE_TYPE || install_return_code != 0); HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey key; installer::ChannelInfo channel_info; - std::wstring reg_key(google_update::kRegPathClientState); + base::string16 reg_key(google_update::kRegPathClientState); reg_key.append(L"\\"); reg_key.append(product_guid); LONG result = key.Open(reg_root, @@ -537,7 +535,7 @@ void GoogleUpdateSettings::UpdateProfileCounts(int profiles_active, int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() { BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring reg_path = dist->GetStateKey(); + base::string16 reg_path = dist->GetStateKey(); // Minimum access needed is to be able to write to this key. RegKey reg_key( @@ -555,7 +553,7 @@ int GoogleUpdateSettings::DuplicateGoogleUpdateSystemClientKey() { } bool GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( - int handle, const std::wstring& key, const std::wstring& value) { + int handle, const base::string16& key, const base::string16& value) { HKEY reg_key = reinterpret_cast<HKEY>(reinterpret_cast<void*>(handle)); DWORD size = static_cast<DWORD>(value.size()) * sizeof(wchar_t); LSTATUS status = RegSetValueEx(reg_key, key.c_str(), 0, REG_SZ, @@ -564,7 +562,7 @@ bool GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( } GoogleUpdateSettings::UpdatePolicy GoogleUpdateSettings::GetAppUpdatePolicy( - const std::wstring& app_guid, + const base::string16& app_guid, bool* is_overridden) { bool found_override = false; UpdatePolicy update_policy = kDefaultUpdatePolicy; diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index a2ff11d..b7bf612 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h @@ -116,19 +116,19 @@ class GoogleUpdateSettings { // Returns in |browser| the browser used to download chrome as recorded // Google Update. Returns false if the information is not available. - static bool GetBrowser(std::wstring* browser); + static bool GetBrowser(base::string16* browser); // Returns in |language| the language selected by the user when downloading // chrome. This information is collected by the web server used to download // the chrome installer. Returns false if the information is not available. - static bool GetLanguage(std::wstring* language); + static bool GetLanguage(base::string16* language); // Returns in |brand| the RLZ brand code or distribution tag that has been // assigned to a partner. Returns false if the information is not available. // // NOTE: This function is Windows only. If the code you are writing is not // specifically for Windows, prefer calling google_brand::GetBrand(). - static bool GetBrand(std::wstring* brand); + static bool GetBrand(base::string16* brand); // Returns in |brand| the RLZ reactivation brand code or distribution tag // that has been assigned to a partner for reactivating a dormant chrome @@ -137,19 +137,19 @@ class GoogleUpdateSettings { // NOTE: This function is Windows only. If the code you are writing is not // specifically for Windows, prefer calling // google_brand::GetReactivationBrand(). - static bool GetReactivationBrand(std::wstring* brand); + static bool GetReactivationBrand(base::string16* brand); // Returns in |client| the google_update client field, which is currently // used to track experiments. Returns false if the entry does not exist. - static bool GetClient(std::wstring* client); + static bool GetClient(base::string16* client); // Sets the google_update client field. Unlike GetClient() this is set only // for the current user. Returns false if the operation failed. - static bool SetClient(const std::wstring& client); + static bool SetClient(const base::string16& client); // Returns in 'client' the RLZ referral available for some distribution // partners. This value does not exist for most chrome or chromium installs. - static bool GetReferral(std::wstring* referral); + static bool GetReferral(base::string16* referral); // Overwrites the current value of the referral with an empty string. Returns // true if this operation succeeded. @@ -192,7 +192,7 @@ class GoogleUpdateSettings { static void UpdateInstallStatus(bool system_install, installer::ArchiveType archive_type, int install_return_code, - const std::wstring& product_guid); + const base::string16& product_guid); // This method updates the value for Google Update "ap" key for Chrome // based on whether we are doing incremental install (or not) and whether @@ -229,13 +229,13 @@ class GoogleUpdateSettings { // Takes a |handle| to a registry key and writes |value| string into the // specified |key|. See DuplicateGoogleUpdateSystemClientKey for details. static bool WriteGoogleUpdateSystemClientKey(int handle, - const std::wstring& key, - const std::wstring& value); + const base::string16& key, + const base::string16& value); // Returns the effective update policy for |app_guid| as dictated by // Group Policy settings. |is_overridden|, if non-NULL, is populated with // true if an app-specific policy override is in force, or false otherwise. - static UpdatePolicy GetAppUpdatePolicy(const std::wstring& app_guid, + static UpdatePolicy GetAppUpdatePolicy(const base::string16& app_guid, bool* is_overridden); // Returns true if the app indicated by |app_guid| should be updated diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index 776faa7..3d4e4ab 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/installer/util/google_update_settings.h" + #include <windows.h> #include <shlwapi.h> // For SHDeleteKey. @@ -15,7 +17,6 @@ #include "chrome/installer/util/fake_installation_state.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/google_update_experiment_util.h" -#include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item_list.h" #include "testing/gtest/include/gtest/gtest.h" @@ -49,7 +50,7 @@ class GoogleUpdateSettingsTest : public testing::Test { RegKey update_key; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring path = dist->GetStateKey(); + base::string16 path = dist->GetStateKey(); ASSERT_EQ(ERROR_SUCCESS, update_key.Create(root, path.c_str(), KEY_WRITE)); ASSERT_EQ(ERROR_SUCCESS, update_key.WriteValue(L"ap", value)); } @@ -58,7 +59,7 @@ class GoogleUpdateSettingsTest : public testing::Test { // the binaries). void SetMultiApField(SystemUserInstall is_system, const wchar_t* value) { // Caller must specify a multi-install ap value. - ASSERT_NE(std::wstring::npos, std::wstring(value).find(L"-multi")); + ASSERT_NE(base::string16::npos, base::string16(value).find(L"-multi")); HKEY root = is_system == SYSTEM_INSTALL ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; RegKey update_key; @@ -70,7 +71,7 @@ class GoogleUpdateSettingsTest : public testing::Test { BrowserDistribution::CHROME_BINARIES) }; for (size_t i = 0; i < arraysize(kDists); ++i) { - std::wstring path = kDists[i]->GetStateKey(); + base::string16 path = kDists[i]->GetStateKey(); ASSERT_EQ(ERROR_SUCCESS, update_key.Create(root, path.c_str(), KEY_WRITE)); ASSERT_EQ(ERROR_SUCCESS, update_key.WriteValue(L"ap", value)); @@ -116,7 +117,7 @@ class GoogleUpdateSettingsTest : public testing::Test { for (size_t i = 0; i < arraysize(prefixes); ++i) { for (size_t j = 0; j < arraysize(expectations); ++j) { for (size_t k = 0; k < arraysize(suffixes); ++k) { - std::wstring ap = prefixes[i]; + base::string16 ap = prefixes[i]; ap += expectations[j].ap_value; ap += suffixes[k]; const wchar_t* channel = expectations[j].channel; @@ -140,7 +141,7 @@ class GoogleUpdateSettingsTest : public testing::Test { BrowserDistribution* chrome = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER); - std::wstring value; + base::string16 value; #if defined(GOOGLE_CHROME_BUILD) EXPECT_TRUE(chrome->ShouldSetExperimentLabels()); @@ -191,9 +192,9 @@ class GoogleUpdateSettingsTest : public testing::Test { // Creates "ap" key with the value given as parameter. Also adds work // items to work_item_list given so that they can be rolled back later. - bool CreateApKey(WorkItemList* work_item_list, const std::wstring& value) { + bool CreateApKey(WorkItemList* work_item_list, const base::string16& value) { HKEY reg_root = HKEY_CURRENT_USER; - std::wstring reg_key = GetApKeyPath(); + base::string16 reg_key = GetApKeyPath(); work_item_list->AddCreateRegKeyWorkItem( reg_root, reg_key, WorkItem::kWow64Default); work_item_list->AddSetRegValueWorkItem(reg_root, @@ -211,18 +212,18 @@ class GoogleUpdateSettingsTest : public testing::Test { // Returns the key path of "ap" key, e.g.: // Google\Update\ClientState\<kTestProductGuid> - std::wstring GetApKeyPath() { - std::wstring reg_key(google_update::kRegPathClientState); + base::string16 GetApKeyPath() { + base::string16 reg_key(google_update::kRegPathClientState); reg_key.append(L"\\"); reg_key.append(kTestProductGuid); return reg_key; } // Utility method to read "ap" key value - std::wstring ReadApKeyValue() { + base::string16 ReadApKeyValue() { RegKey key; - std::wstring ap_key_value; - std::wstring reg_key = GetApKeyPath(); + base::string16 ap_key_value; + base::string16 reg_key = GetApKeyPath(); if (key.Open(HKEY_CURRENT_USER, reg_key.c_str(), KEY_ALL_ACCESS) == ERROR_SUCCESS) { key.ReadValue(google_update::kRegApField, &ap_key_value); @@ -519,8 +520,8 @@ TEST_F(GoogleUpdateSettingsTest, UpdateInstallStatusTest) { work_item_list.reset(WorkItem::CreateWorkItemList()); // Test the case of when "ap" key doesnt exist at all - std::wstring ap_key_value = ReadApKeyValue(); - std::wstring reg_key = GetApKeyPath(); + base::string16 ap_key_value = ReadApKeyValue(); + base::string16 reg_key = GetApKeyPath(); HKEY reg_root = HKEY_CURRENT_USER; bool ap_key_deleted = false; RegKey key; @@ -688,7 +689,7 @@ TEST_F(GoogleUpdateSettingsTest, GetAppUpdatePolicyDefaultOverride) { // Test that an app-specific override is used if present. TEST_F(GoogleUpdateSettingsTest, GetAppUpdatePolicyAppOverride) { - std::wstring app_policy_value( + base::string16 app_policy_value( GoogleUpdateSettings::kUpdateOverrideValuePrefix); app_policy_value.append(kTestProductGuid); @@ -1036,34 +1037,34 @@ class CollectStatsConsent : public ::testing::TestWithParam<StatsState> { static void MakeChromeMultiInstall(HKEY root_key); static void ApplySetting(StatsState::StateSetting setting, HKEY root_key, - const std::wstring& reg_key); + const base::string16& reg_key); - static std::wstring* chrome_version_key_; - static std::wstring* chrome_state_key_; - static std::wstring* chrome_state_medium_key_; - static std::wstring* binaries_state_key_; - static std::wstring* binaries_state_medium_key_; + static base::string16* chrome_version_key_; + static base::string16* chrome_state_key_; + static base::string16* chrome_state_medium_key_; + static base::string16* binaries_state_key_; + static base::string16* binaries_state_medium_key_; registry_util::RegistryOverrideManager override_manager_; }; -std::wstring* CollectStatsConsent::chrome_version_key_; -std::wstring* CollectStatsConsent::chrome_state_key_; -std::wstring* CollectStatsConsent::chrome_state_medium_key_; -std::wstring* CollectStatsConsent::binaries_state_key_; -std::wstring* CollectStatsConsent::binaries_state_medium_key_; +base::string16* CollectStatsConsent::chrome_version_key_; +base::string16* CollectStatsConsent::chrome_state_key_; +base::string16* CollectStatsConsent::chrome_state_medium_key_; +base::string16* CollectStatsConsent::binaries_state_key_; +base::string16* CollectStatsConsent::binaries_state_medium_key_; void CollectStatsConsent::SetUpTestCase() { BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BROWSER); - chrome_version_key_ = new std::wstring(dist->GetVersionKey()); - chrome_state_key_ = new std::wstring(dist->GetStateKey()); - chrome_state_medium_key_ = new std::wstring(dist->GetStateMediumKey()); + chrome_version_key_ = new base::string16(dist->GetVersionKey()); + chrome_state_key_ = new base::string16(dist->GetStateKey()); + chrome_state_medium_key_ = new base::string16(dist->GetStateMediumKey()); dist = BrowserDistribution::GetSpecificDistribution( BrowserDistribution::CHROME_BINARIES); - binaries_state_key_ = new std::wstring(dist->GetStateKey()); - binaries_state_medium_key_ = new std::wstring(dist->GetStateMediumKey()); + binaries_state_key_ = new base::string16(dist->GetStateKey()); + binaries_state_medium_key_ = new base::string16(dist->GetStateMediumKey()); } void CollectStatsConsent::TearDownTestCase() { @@ -1078,7 +1079,8 @@ void CollectStatsConsent::TearDownTestCase() { void CollectStatsConsent::SetUp() { const StatsState& stats_state = GetParam(); const HKEY root_key = stats_state.root_key(); - std::wstring reg_temp_name(stats_state.system_level() ? L"HKLM_" : L"HKCU_"); + base::string16 reg_temp_name( + stats_state.system_level() ? L"HKLM_" : L"HKCU_"); reg_temp_name += L"CollectStatsConsent"; override_manager_.OverrideRegistry(root_key, reg_temp_name); @@ -1112,7 +1114,7 @@ void CollectStatsConsent::MakeChromeMultiInstall(HKEY root_key) { // Write the correct value to represent |setting| in the registry. void CollectStatsConsent::ApplySetting(StatsState::StateSetting setting, HKEY root_key, - const std::wstring& reg_key) { + const base::string16& reg_key) { if (setting != StatsState::NO_SETTING) { DWORD value = setting != StatsState::FALSE_SETTING ? 1 : 0; ASSERT_EQ( @@ -1140,7 +1142,7 @@ TEST_P(CollectStatsConsent, SetCollectStatsConsentAtLevel) { EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsentAtLevel( GetParam().system_level(), !GetParam().is_consent_granted())); - const std::wstring* const reg_keys[] = { + const base::string16* const reg_keys[] = { chrome_state_key_, chrome_state_medium_key_, binaries_state_key_, @@ -1148,7 +1150,7 @@ TEST_P(CollectStatsConsent, SetCollectStatsConsentAtLevel) { }; int key_index = ((GetParam().system_level() ? 1 : 0) + (GetParam().multi_install() ? 2 : 0)); - const std::wstring& reg_key = *reg_keys[key_index]; + const base::string16& reg_key = *reg_keys[key_index]; DWORD value = 0; EXPECT_EQ( ERROR_SUCCESS, diff --git a/chrome/installer/util/language_selector.cc b/chrome/installer/util/language_selector.cc index 0dc3f58..a58048d 100644 --- a/chrome/installer/util/language_selector.cc +++ b/chrome/installer/util/language_selector.cc @@ -11,6 +11,7 @@ #include <functional> #include "base/logging.h" +#include "base/strings/string16.h" #include "base/strings/string_util.h" #include "base/win/i18n.h" #include "chrome/installer/util/google_update_settings.h" @@ -190,7 +191,7 @@ bool MatchLanguageOffset(const std::wstring& language, int* offset) { // configured languages. void GetCandidatesFromSystem(std::vector<std::wstring>* candidates) { DCHECK(candidates); - std::wstring language; + base::string16 language; // Omaha gets first pick. GoogleUpdateSettings::GetLanguage(&language); |