Commit aab3f480 authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Replace GetStateMediumKey() with GetClientStateMediumKeyPath.

Also moves some consumes of InstallDetails to the new convenience
functions in install_static.

BUG=879568

Change-Id: I01c5c05f10a57407b3981ab64c6d4da2bb8de088
Reviewed-on: https://chromium-review.googlesource.com/1213145
Commit-Queue: Greg Thompson <grt@chromium.org>
Reviewed-by: default avatarPatrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589800}
parent e7dc4488
...@@ -372,6 +372,10 @@ std::wstring GetClientStateKeyPath() { ...@@ -372,6 +372,10 @@ std::wstring GetClientStateKeyPath() {
return GetClientStateKeyPath(GetAppGuid()); return GetClientStateKeyPath(GetAppGuid());
} }
std::wstring GetClientStateMediumKeyPath() {
return GetClientStateMediumKeyPath(GetAppGuid());
}
std::wstring GetUninstallRegistryPath() { std::wstring GetUninstallRegistryPath() {
std::wstring result( std::wstring result(
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"); L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\");
......
...@@ -66,14 +66,28 @@ std::wstring GetChromeInstallSubDirectory(); ...@@ -66,14 +66,28 @@ std::wstring GetChromeInstallSubDirectory();
// their browsing data. // their browsing data.
std::wstring GetRegistryPath(); std::wstring GetRegistryPath();
// The next set of registry paths are generally for integration with an Omaha
// updater (see https://github.com/google/omaha); Google Chrome builds integrate
// with Google Update. For all accesses, HKLM or HKCU must be used based on
// IsSystemInstall(). Additionally, KEY_WOW64_32KEY must be used for all
// accesses, as Omaha updaters exclusively use the 32-bit view of the registry.
// Returns the path "Software\Google\Update\Clients\<guid>" where "<guid>" is // Returns the path "Software\Google\Update\Clients\<guid>" where "<guid>" is
// the current install mode's appguid. // the current install mode's appguid. This key is primarily used for
// registering the browser as an app managed by the updater.
std::wstring GetClientsKeyPath(); std::wstring GetClientsKeyPath();
// Returns the path "Software\Google\Update\ClientState\<guid>" where "<guid>" // Returns the path "Software\Google\Update\ClientState\<guid>" where "<guid>"
// is the current install mode's appguid. // is the current install mode's appguid. This key is primarily (but not
// exclusively) used for holding install-wide state that is used by both the
// updater and the browser.
std::wstring GetClientStateKeyPath(); std::wstring GetClientStateKeyPath();
// Returns the path "Software\Google\Update\ClientStateMedium\<guid>" where
// "<guid>" is the current install mode's appguid. This is is used exclusively
// for system-wide installs to hold values written by the browser.
std::wstring GetClientStateMediumKeyPath();
// Returns the path // Returns the path
// "Software\Microsoft\Windows\CurrentVersion\Uninstall\[kCompanyPathName ] // "Software\Microsoft\Windows\CurrentVersion\Uninstall\[kCompanyPathName ]
// kProductPathName[install_suffix]. This is the key used for the browser's // kProductPathName[install_suffix]. This is the key used for the browser's
......
...@@ -409,16 +409,17 @@ void AddMigrateUsageStatsWorkItems(const InstallerState& installer_state, ...@@ -409,16 +409,17 @@ void AddMigrateUsageStatsWorkItems(const InstallerState& installer_state,
if (!AreBinariesInstalled(installer_state)) if (!AreBinariesInstalled(installer_state))
return; return;
BrowserDistribution* chrome_dist = installer_state.product().distribution();
// Delete any stale value in Chrome's ClientStateMedium key. A new value, if // Delete any stale value in Chrome's ClientStateMedium key. A new value, if
// found, will be written to the ClientState key below. // found, will be written to the ClientState key below.
if (installer_state.system_install()) { if (installer_state.system_install()) {
install_list->AddDeleteRegValueWorkItem( install_list->AddDeleteRegValueWorkItem(
installer_state.root_key(), chrome_dist->GetStateMediumKey(), installer_state.root_key(),
KEY_WOW64_64KEY, google_update::kRegUsageStatsField); install_static::GetClientStateMediumKeyPath(), KEY_WOW64_64KEY,
google_update::kRegUsageStatsField);
} }
BrowserDistribution* chrome_dist = installer_state.product().distribution();
google_update::Tristate consent = google_update::Tristate consent =
GoogleUpdateSettings::GetCollectStatsConsentForApp( GoogleUpdateSettings::GetCollectStatsConsentForApp(
installer_state.system_install(), *MakeBinariesRegistrationData()); installer_state.system_install(), *MakeBinariesRegistrationData());
...@@ -768,8 +769,7 @@ bool AppendPostInstallTasks(const InstallerState& installer_state, ...@@ -768,8 +769,7 @@ bool AppendPostInstallTasks(const InstallerState& installer_state,
// installs. // installs.
if (install_static::kUseGoogleUpdateIntegration && if (install_static::kUseGoogleUpdateIntegration &&
installer_state.system_install()) { installer_state.system_install()) {
const base::string16 path = const base::string16 path = install_static::GetClientStateMediumKeyPath();
install_static::InstallDetails::Get().GetClientStateMediumKeyPath();
post_install_task_list post_install_task_list
->AddCreateRegKeyWorkItem(HKEY_LOCAL_MACHINE, path, KEY_WOW64_32KEY) ->AddCreateRegKeyWorkItem(HKEY_LOCAL_MACHINE, path, KEY_WOW64_32KEY)
->set_best_effort(true); ->set_best_effort(true);
......
...@@ -31,10 +31,7 @@ class UserExperimentTest : public ::testing::TestWithParam<bool> { ...@@ -31,10 +31,7 @@ class UserExperimentTest : public ::testing::TestWithParam<bool> {
// Create the ClientState key. // Create the ClientState key.
base::win::RegKey key; base::win::RegKey key;
ASSERT_EQ(key.Create(root_, ASSERT_EQ(key.Create(root_, install_static::GetClientStateKeyPath().c_str(),
install_static::InstallDetails::Get()
.GetClientStateKeyPath()
.c_str(),
KEY_WOW64_64KEY | KEY_SET_VALUE), KEY_WOW64_64KEY | KEY_SET_VALUE),
ERROR_SUCCESS); ERROR_SUCCESS);
} }
......
...@@ -13,7 +13,6 @@ class AppRegistrationData { ...@@ -13,7 +13,6 @@ class AppRegistrationData {
public: public:
virtual ~AppRegistrationData() {} virtual ~AppRegistrationData() {}
virtual base::string16 GetStateKey() const = 0; virtual base::string16 GetStateKey() const = 0;
virtual base::string16 GetStateMediumKey() const = 0;
}; };
#endif // CHROME_INSTALLER_UTIL_APP_REGISTRATION_DATA_H_ #endif // CHROME_INSTALLER_UTIL_APP_REGISTRATION_DATA_H_
...@@ -69,7 +69,3 @@ const AppRegistrationData& BrowserDistribution::GetAppRegistrationData() const { ...@@ -69,7 +69,3 @@ const AppRegistrationData& BrowserDistribution::GetAppRegistrationData() const {
base::string16 BrowserDistribution::GetStateKey() const { base::string16 BrowserDistribution::GetStateKey() const {
return app_reg_data_->GetStateKey(); return app_reg_data_->GetStateKey();
} }
base::string16 BrowserDistribution::GetStateMediumKey() const {
return app_reg_data_->GetStateMediumKey();
}
...@@ -23,7 +23,6 @@ class BrowserDistribution { ...@@ -23,7 +23,6 @@ class BrowserDistribution {
// Getter and adaptors for the underlying |app_reg_data_|. // Getter and adaptors for the underlying |app_reg_data_|.
const AppRegistrationData& GetAppRegistrationData() const; const AppRegistrationData& GetAppRegistrationData() const;
base::string16 GetStateKey() const; base::string16 GetStateKey() const;
base::string16 GetStateMediumKey() const;
protected: protected:
explicit BrowserDistribution( explicit BrowserDistribution(
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/strings/string_piece.h" #include "base/strings/string_piece.h"
#include "base/test/test_reg_util_win.h" #include "base/test/test_reg_util_win.h"
#include "chrome/install_static/install_details.h" #include "chrome/install_static/install_util.h"
#include "chrome/install_static/test/scoped_install_details.h" #include "chrome/install_static/test/scoped_install_details.h"
#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/experiment.h" #include "chrome/installer/util/experiment.h"
...@@ -35,11 +35,10 @@ class ExperimentStorageTest : public ::testing::TestWithParam<bool> { ...@@ -35,11 +35,10 @@ class ExperimentStorageTest : public ::testing::TestWithParam<bool> {
// Create an empty participation key since participation registry is assumed // Create an empty participation key since participation registry is assumed
// to be present for chrome build. // to be present for chrome build.
base::win::RegKey key; base::win::RegKey key;
ASSERT_EQ(ERROR_SUCCESS, key.Create(root(), ASSERT_EQ(
install_static::InstallDetails::Get() ERROR_SUCCESS,
.GetClientStateKeyPath() key.Create(root(), install_static::GetClientStateKeyPath().c_str(),
.c_str(), KEY_WOW64_32KEY | KEY_QUERY_VALUE));
KEY_WOW64_32KEY | KEY_QUERY_VALUE));
} }
bool system_level_install_; bool system_level_install_;
...@@ -146,7 +145,7 @@ TEST_P(ExperimentStorageTest, TestLoadStoreExperiment) { ...@@ -146,7 +145,7 @@ TEST_P(ExperimentStorageTest, TestLoadStoreExperiment) {
base::win::RegKey key; base::win::RegKey key;
base::string16 client_state_path( base::string16 client_state_path(
system_level_install_ system_level_install_
? BrowserDistribution::GetDistribution()->GetStateMediumKey() ? install_static::GetClientStateMediumKeyPath()
: BrowserDistribution::GetDistribution()->GetStateKey()); : BrowserDistribution::GetDistribution()->GetStateKey());
client_state_path.append(L"\\Retention"); client_state_path.append(L"\\Retention");
EXPECT_EQ(ERROR_SUCCESS, key.Open(root(), client_state_path.c_str(), EXPECT_EQ(ERROR_SUCCESS, key.Open(root(), client_state_path.c_str(),
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "base/win/registry.h" #include "base/win/registry.h"
#include "base/win/win_util.h" #include "base/win/win_util.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/install_static/install_details.h"
#include "chrome/install_static/install_modes.h" #include "chrome/install_static/install_modes.h"
#include "chrome/install_static/install_util.h" #include "chrome/install_static/install_util.h"
#include "chrome/installer/util/app_registration_data.h" #include "chrome/installer/util/app_registration_data.h"
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
#include "chrome/installer/util/installation_state.h" #include "chrome/installer/util/installation_state.h"
using base::win::RegKey; using base::win::RegKey;
using install_static::InstallDetails;
using installer::InstallationState; using installer::InstallationState;
const wchar_t GoogleUpdateSettings::kPoliciesKey[] = const wchar_t GoogleUpdateSettings::kPoliciesKey[] =
...@@ -70,7 +68,7 @@ bool ReadGoogleUpdateStrKeyFromRoot(HKEY root, ...@@ -70,7 +68,7 @@ bool ReadGoogleUpdateStrKeyFromRoot(HKEY root,
const wchar_t* const name, const wchar_t* const name,
base::string16* value) { base::string16* value) {
RegKey key; RegKey key;
return key.Open(root, InstallDetails::Get().GetClientStateKeyPath().c_str(), return key.Open(root, install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS && KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.ReadValue(name, value) == ERROR_SUCCESS; key.ReadValue(name, value) == ERROR_SUCCESS;
} }
...@@ -112,7 +110,7 @@ bool WriteGoogleUpdateAggregateNumKeyInternal(const wchar_t* const name, ...@@ -112,7 +110,7 @@ bool WriteGoogleUpdateAggregateNumKeyInternal(const wchar_t* const name,
return false; return false;
} }
base::string16 reg_path(InstallDetails::Get().GetClientStateMediumKeyPath()); base::string16 reg_path(install_static::GetClientStateMediumKeyPath());
reg_path.append(L"\\").append(name); reg_path.append(L"\\").append(name);
RegKey key; RegKey key;
if (key.Create(HKEY_LOCAL_MACHINE, reg_path.c_str(), if (key.Create(HKEY_LOCAL_MACHINE, reg_path.c_str(),
...@@ -130,7 +128,7 @@ bool WriteUserGoogleUpdateStrKey(const wchar_t* const name, ...@@ -130,7 +128,7 @@ bool WriteUserGoogleUpdateStrKey(const wchar_t* const name,
const base::string16& value) { const base::string16& value) {
RegKey key; RegKey key;
return key.Create(HKEY_CURRENT_USER, return key.Create(HKEY_CURRENT_USER,
InstallDetails::Get().GetClientStateKeyPath().c_str(), install_static::GetClientStateKeyPath().c_str(),
KEY_SET_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS && KEY_SET_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.WriteValue(name, value.c_str()) == ERROR_SUCCESS; key.WriteValue(name, value.c_str()) == ERROR_SUCCESS;
} }
...@@ -155,7 +153,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) { ...@@ -155,7 +153,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
RegKey key; RegKey key;
auto result = key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE auto result = key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER, : HKEY_CURRENT_USER,
InstallDetails::Get().GetClientStateKeyPath().c_str(), install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY); KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY);
if (result == ERROR_PATH_NOT_FOUND || result == ERROR_FILE_NOT_FOUND) if (result == ERROR_PATH_NOT_FOUND || result == ERROR_FILE_NOT_FOUND)
return true; // The key doesn't exist; consider the value cleared. return true; // The key doesn't exist; consider the value cleared.
...@@ -176,7 +174,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) { ...@@ -176,7 +174,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
bool RemoveUserGoogleUpdateStrKey(const wchar_t* const name) { bool RemoveUserGoogleUpdateStrKey(const wchar_t* const name) {
RegKey key; RegKey key;
auto result = key.Open(HKEY_CURRENT_USER, auto result = key.Open(HKEY_CURRENT_USER,
InstallDetails::Get().GetClientStateKeyPath().c_str(), install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY); KEY_QUERY_VALUE | KEY_SET_VALUE | KEY_WOW64_32KEY);
if (result == ERROR_PATH_NOT_FOUND || result == ERROR_FILE_NOT_FOUND) if (result == ERROR_PATH_NOT_FOUND || result == ERROR_FILE_NOT_FOUND)
return true; // The key doesn't exist; consider the value cleared. return true; // The key doesn't exist; consider the value cleared.
...@@ -258,12 +256,12 @@ google_update::Tristate GoogleUpdateSettings::GetCollectStatsConsentForApp( ...@@ -258,12 +256,12 @@ google_update::Tristate GoogleUpdateSettings::GetCollectStatsConsentForApp(
const REGSAM kAccess = KEY_QUERY_VALUE | KEY_WOW64_32KEY; const REGSAM kAccess = KEY_QUERY_VALUE | KEY_WOW64_32KEY;
// For system-level installs, try ClientStateMedium first. // For system-level installs, try ClientStateMedium first.
have_value = have_value = system_install &&
system_install && key.Open(HKEY_LOCAL_MACHINE,
key.Open(HKEY_LOCAL_MACHINE, reg_data.GetStateMediumKey().c_str(), install_static::GetClientStateMediumKeyPath().c_str(),
kAccess) == ERROR_SUCCESS && kAccess) == ERROR_SUCCESS &&
key.ReadValueDW(google_update::kRegUsageStatsField, &value) == key.ReadValueDW(google_update::kRegUsageStatsField, &value) ==
ERROR_SUCCESS; ERROR_SUCCESS;
// Otherwise, try ClientState. // Otherwise, try ClientState.
if (!have_value) { if (!have_value) {
...@@ -290,8 +288,9 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install, ...@@ -290,8 +288,9 @@ bool GoogleUpdateSettings::SetCollectStatsConsentAtLevel(bool system_install,
// Write to ClientStateMedium for system-level; ClientState otherwise. // Write to ClientStateMedium for system-level; ClientState otherwise.
HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
base::string16 reg_path = base::string16 reg_path = system_install
system_install ? dist->GetStateMediumKey() : dist->GetStateKey(); ? install_static::GetClientStateMediumKeyPath()
: dist->GetStateKey();
RegKey key; RegKey key;
LONG result = key.Create( LONG result = key.Create(
root_key, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY); root_key, reg_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
...@@ -379,7 +378,8 @@ bool GoogleUpdateSettings::SetEULAConsent( ...@@ -379,7 +378,8 @@ bool GoogleUpdateSettings::SetEULAConsent(
RegKey key; RegKey key;
// Write the consent value into the product's ClientStateMedium key. // Write the consent value into the product's ClientStateMedium key.
return key.Create(HKEY_LOCAL_MACHINE, dist->GetStateMediumKey().c_str(), return key.Create(HKEY_LOCAL_MACHINE,
install_static::GetClientStateMediumKeyPath().c_str(),
kAccess) == ERROR_SUCCESS && kAccess) == ERROR_SUCCESS &&
key.WriteValue(google_update::kRegEULAAceptedField, eula_accepted) == key.WriteValue(google_update::kRegEULAAceptedField, eula_accepted) ==
ERROR_SUCCESS; ERROR_SUCCESS;
...@@ -862,8 +862,9 @@ bool GoogleUpdateSettings::SetExperimentLabels( ...@@ -862,8 +862,9 @@ bool GoogleUpdateSettings::SetExperimentLabels(
// client state/app guid key. // client state/app guid key.
bool success = false; bool success = false;
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::string16 client_state_path(system_install ? dist->GetStateMediumKey() base::string16 client_state_path(
: dist->GetStateKey()); system_install ? install_static::GetClientStateMediumKeyPath()
: dist->GetStateKey());
RegKey client_state(reg_root, client_state_path.c_str(), RegKey client_state(reg_root, client_state_path.c_str(),
KEY_SET_VALUE | KEY_WOW64_32KEY); KEY_SET_VALUE | KEY_WOW64_32KEY);
// It is possible that the registry keys do not yet exist or have not yet // It is possible that the registry keys do not yet exist or have not yet
...@@ -888,7 +889,8 @@ bool GoogleUpdateSettings::ReadExperimentLabels( ...@@ -888,7 +889,8 @@ bool GoogleUpdateSettings::ReadExperimentLabels(
HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); BrowserDistribution* dist = BrowserDistribution::GetDistribution();
base::string16 client_state_path( base::string16 client_state_path(
system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); system_install ? install_static::GetClientStateMediumKeyPath()
: dist->GetStateKey());
RegKey client_state; RegKey client_state;
LONG result = client_state.Open( LONG result = client_state.Open(
......
...@@ -82,8 +82,10 @@ class GoogleUpdateSettingsTest : public testing::Test { ...@@ -82,8 +82,10 @@ class GoogleUpdateSettingsTest : public testing::Test {
HKEY root = install == SYSTEM_INSTALL ? HKEY root = install == SYSTEM_INSTALL ?
HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
BrowserDistribution* chrome = BrowserDistribution::GetDistribution(); BrowserDistribution* chrome = BrowserDistribution::GetDistribution();
base::string16 state_key = install == SYSTEM_INSTALL ? base::string16 state_key =
chrome->GetStateMediumKey() : chrome->GetStateKey(); install == SYSTEM_INSTALL
? install_static::GetClientStateMediumKeyPath()
: chrome->GetStateKey();
EXPECT_EQ(ERROR_SUCCESS, EXPECT_EQ(ERROR_SUCCESS,
key.Open(root, state_key.c_str(), KEY_QUERY_VALUE)); key.Open(root, state_key.c_str(), KEY_QUERY_VALUE));
...@@ -424,8 +426,9 @@ TEST_F(GoogleUpdateSettingsTest, SetEULAConsent) { ...@@ -424,8 +426,9 @@ TEST_F(GoogleUpdateSettingsTest, SetEULAConsent) {
EXPECT_TRUE(GoogleUpdateSettings::SetEULAConsent(machine_state, chrome, EXPECT_TRUE(GoogleUpdateSettings::SetEULAConsent(machine_state, chrome,
true)); true));
EXPECT_EQ(ERROR_SUCCESS, EXPECT_EQ(ERROR_SUCCESS,
key.Open(HKEY_LOCAL_MACHINE, chrome->GetStateMediumKey().c_str(), key.Open(HKEY_LOCAL_MACHINE,
KEY_QUERY_VALUE)); install_static::GetClientStateMediumKeyPath().c_str(),
KEY_QUERY_VALUE));
EXPECT_EQ(ERROR_SUCCESS, EXPECT_EQ(ERROR_SUCCESS,
key.ReadValueDW(google_update::kRegEULAAceptedField, &value)); key.ReadValueDW(google_update::kRegEULAAceptedField, &value));
EXPECT_EQ(1U, value); EXPECT_EQ(1U, value);
...@@ -466,8 +469,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateProfileCountsSystemInstall) { ...@@ -466,8 +469,7 @@ TEST_F(GoogleUpdateSettingsTest, UpdateProfileCountsSystemInstall) {
install_static::ScopedInstallDetails details(true /* system_level */); install_static::ScopedInstallDetails details(true /* system_level */);
// No profile count keys present yet. // No profile count keys present yet.
const base::string16& state_key = BrowserDistribution::GetDistribution()-> base::string16 state_key = install_static::GetClientStateMediumKeyPath();
GetAppRegistrationData().GetStateMediumKey();
base::string16 num_profiles_path(state_key); base::string16 num_profiles_path(state_key);
num_profiles_path.append(L"\\"); num_profiles_path.append(L"\\");
num_profiles_path.append(google_update::kRegProfilesActive); num_profiles_path.append(google_update::kRegProfilesActive);
...@@ -1070,8 +1072,9 @@ void CollectStatsConsent::SetUp() { ...@@ -1070,8 +1072,9 @@ void CollectStatsConsent::SetUp() {
const HKEY root_key = stats_state.root_key(); const HKEY root_key = stats_state.root_key();
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(
ApplySetting(stats_state.state_value(), root_key, dist_->GetStateKey())); ApplySetting(stats_state.state_value(), root_key, dist_->GetStateKey()));
ASSERT_NO_FATAL_FAILURE(ApplySetting(stats_state.state_medium_value(), ASSERT_NO_FATAL_FAILURE(
root_key, dist_->GetStateMediumKey())); ApplySetting(stats_state.state_medium_value(), root_key,
install_static::GetClientStateMediumKeyPath()));
} }
// Write the correct value to represent |setting| in the registry. // Write the correct value to represent |setting| in the registry.
...@@ -1116,9 +1119,9 @@ TEST_P(CollectStatsConsent, SetCollectStatsConsentAtLevel) { ...@@ -1116,9 +1119,9 @@ TEST_P(CollectStatsConsent, SetCollectStatsConsentAtLevel) {
GetParam().system_level(), GetParam().system_level(),
!GetParam().is_consent_granted())); !GetParam().is_consent_granted()));
const base::string16 reg_key = GetParam().system_level() const base::string16 reg_key =
? dist_->GetStateMediumKey() GetParam().system_level() ? install_static::GetClientStateMediumKeyPath()
: dist_->GetStateKey(); : dist_->GetStateKey();
DWORD value = 0; DWORD value = 0;
EXPECT_EQ( EXPECT_EQ(
ERROR_SUCCESS, ERROR_SUCCESS,
......
...@@ -125,8 +125,8 @@ bool ProductState::Initialize(bool system_install) { ...@@ -125,8 +125,8 @@ bool ProductState::Initialize(bool system_install) {
// Read from the ClientStateMedium key. Values here override those in // Read from the ClientStateMedium key. Values here override those in
// ClientState. // ClientState.
if (system_install && if (system_install &&
key.Open(root_key, distribution->GetStateMediumKey().c_str(), kAccess) == key.Open(root_key, install_static::GetClientStateMediumKeyPath().c_str(),
ERROR_SUCCESS) { kAccess) == ERROR_SUCCESS) {
DWORD dword_value = 0; DWORD dword_value = 0;
if (key.ReadValueDW(google_update::kRegUsageStatsField, if (key.ReadValueDW(google_update::kRegUsageStatsField,
......
...@@ -12,7 +12,3 @@ NonUpdatingAppRegistrationData::~NonUpdatingAppRegistrationData() {} ...@@ -12,7 +12,3 @@ NonUpdatingAppRegistrationData::~NonUpdatingAppRegistrationData() {}
base::string16 NonUpdatingAppRegistrationData::GetStateKey() const { base::string16 NonUpdatingAppRegistrationData::GetStateKey() const {
return key_path_; return key_path_;
} }
base::string16 NonUpdatingAppRegistrationData::GetStateMediumKey() const {
return key_path_;
}
...@@ -16,7 +16,6 @@ class NonUpdatingAppRegistrationData : public AppRegistrationData { ...@@ -16,7 +16,6 @@ class NonUpdatingAppRegistrationData : public AppRegistrationData {
explicit NonUpdatingAppRegistrationData(const base::string16& key_path); explicit NonUpdatingAppRegistrationData(const base::string16& key_path);
~NonUpdatingAppRegistrationData() override; ~NonUpdatingAppRegistrationData() override;
base::string16 GetStateKey() const override; base::string16 GetStateKey() const override;
base::string16 GetStateMediumKey() const override;
private: private:
const base::string16 key_path_; const base::string16 key_path_;
......
...@@ -13,7 +13,3 @@ TestAppRegistrationData::~TestAppRegistrationData() { ...@@ -13,7 +13,3 @@ TestAppRegistrationData::~TestAppRegistrationData() {
base::string16 TestAppRegistrationData::GetStateKey() const { base::string16 TestAppRegistrationData::GetStateKey() const {
return L"Software\\Chromium\\ClientState\\test_app_guid"; return L"Software\\Chromium\\ClientState\\test_app_guid";
} }
base::string16 TestAppRegistrationData::GetStateMediumKey() const {
return L"Software\\Chromium\\ClientStateMedium\\test_app_guid";
}
...@@ -12,7 +12,6 @@ class TestAppRegistrationData : public AppRegistrationData { ...@@ -12,7 +12,6 @@ class TestAppRegistrationData : public AppRegistrationData {
TestAppRegistrationData(); TestAppRegistrationData();
~TestAppRegistrationData() override; ~TestAppRegistrationData() override;
base::string16 GetStateKey() const override; base::string16 GetStateKey() const override;
base::string16 GetStateMediumKey() const override;
}; };
#endif // CHROME_INSTALLER_UTIL_TEST_APP_REGISTRATION_DATA_H_ #endif // CHROME_INSTALLER_UTIL_TEST_APP_REGISTRATION_DATA_H_
...@@ -16,9 +16,3 @@ base::string16 UpdatingAppRegistrationData::GetStateKey() const { ...@@ -16,9 +16,3 @@ base::string16 UpdatingAppRegistrationData::GetStateKey() const {
.append(1, L'\\') .append(1, L'\\')
.append(app_guid_); .append(app_guid_);
} }
base::string16 UpdatingAppRegistrationData::GetStateMediumKey() const {
return base::string16(google_update::kRegPathClientStateMedium)
.append(1, L'\\')
.append(app_guid_);
}
...@@ -16,7 +16,6 @@ class UpdatingAppRegistrationData : public AppRegistrationData { ...@@ -16,7 +16,6 @@ class UpdatingAppRegistrationData : public AppRegistrationData {
explicit UpdatingAppRegistrationData(const base::string16& app_guid); explicit UpdatingAppRegistrationData(const base::string16& app_guid);
~UpdatingAppRegistrationData() override; ~UpdatingAppRegistrationData() override;
base::string16 GetStateKey() const override; base::string16 GetStateKey() const override;
base::string16 GetStateMediumKey() const override;
private: private:
const base::string16 app_guid_; const base::string16 app_guid_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment