summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 19:24:26 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-11 19:24:26 +0000
commit74417a819d52539d3b23ab4fc22143f080cc575c (patch)
tree551fbea34d046295b32b9d250c12a3491c1143ba /chrome
parentb49c88564b3a9dd58046440d3754d57dca05fef8 (diff)
downloadchromium_src-74417a819d52539d3b23ab4fc22143f080cc575c.zip
chromium_src-74417a819d52539d3b23ab4fc22143f080cc575c.tar.gz
chromium_src-74417a819d52539d3b23ab4fc22143f080cc575c.tar.bz2
Inform google_update that the user has acepted the EULA
- reg key lives in hklm but we can write it BUG=b/1594565 Review URL: http://codereview.chromium.org/43061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/installer/setup/main.cc5
-rw-r--r--chrome/installer/util/google_update_constants.cc3
-rw-r--r--chrome/installer/util/google_update_constants.h6
-rw-r--r--chrome/installer/util/google_update_settings.cc24
-rw-r--r--chrome/installer/util/google_update_settings.h4
5 files changed, 33 insertions, 9 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 6a2a170..c88d289 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -26,6 +26,7 @@
#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/logging_installer.h"
#include "chrome/installer/util/lzma_util.h"
+#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/shell_util.h"
@@ -544,7 +545,9 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// Check if we need to show the EULA. If it is passed as a command line
// then the dialog is shown and regardless of the outcome setup exits here.
if (parsed_command_line.HasSwitch(installer_util::switches::kShowEula)) {
- return ShowEULADialog();
+ installer_util::InstallStatus eula = ShowEULADialog();
+ GoogleUpdateSettings::SetEULAConsent(installer_util::EULA_REJECTED != eula);
+ return eula;
}
// If --register-chrome-browser option is specified, register all
diff --git a/chrome/installer/util/google_update_constants.cc b/chrome/installer/util/google_update_constants.cc
index fd18e09..2ee142b 100644
--- a/chrome/installer/util/google_update_constants.cc
+++ b/chrome/installer/util/google_update_constants.cc
@@ -11,6 +11,8 @@ const wchar_t kGearsUpgradeCode[] = L"{D92DBAED-3E3E-4530-B30D-072D16C7DDD0}";
const wchar_t kRegPathClients[] = L"Software\\Google\\Update\\Clients";
const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState";
+const wchar_t kRegPathClientStateMedium[]
+ = L"Software\\Google\\Update\\ClientStateMedium";
const wchar_t kRegApField[] = L"ap";
const wchar_t kRegBrowserField[] = L"browser";
@@ -24,6 +26,7 @@ const wchar_t kRegRLZBrandField[] = L"brand";
const wchar_t kRegUsageStatsField[] = L"usagestats";
const wchar_t kRegVersionField[] = L"pv";
const wchar_t kRegReferralField[] = L"referral";
+const wchar_t kRegEULAAceptedField[] = L"eulaaccepted";
const wchar_t kEnvProductVersionKey[] = L"CHROME_VERSION";
} // namespace installer
diff --git a/chrome/installer/util/google_update_constants.h b/chrome/installer/util/google_update_constants.h
index f6b833f..72cfe0b 100644
--- a/chrome/installer/util/google_update_constants.h
+++ b/chrome/installer/util/google_update_constants.h
@@ -15,7 +15,12 @@ extern const wchar_t kChromeGuid[];
extern const wchar_t kGearsUpgradeCode[];
extern const wchar_t kRegPathClients[];
+
+// The difference between ClientState and ClientStateMedium is that the former
+// lives on HKCU or HKLM and the later always lives in HKLM. The only use of
+// the ClientStateMedium is for the EULA consent. See bug 1594565.
extern const wchar_t kRegPathClientState[];
+extern const wchar_t kRegPathClientStateMedium[];
extern const wchar_t kRegApField[];
extern const wchar_t kRegBrowserField[];
@@ -29,6 +34,7 @@ extern const wchar_t kRegRLZBrandField[];
extern const wchar_t kRegUsageStatsField[];
extern const wchar_t kRegVersionField[];
extern const wchar_t kRegReferralField[];
+extern const wchar_t kRegEULAAceptedField[];
extern const wchar_t kEnvProductVersionKey[];
} // namespace google_update
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index cb122f8..4e04c3f 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -9,15 +9,17 @@
namespace {
-std::wstring GetClientStateKeyPath() {
- std::wstring reg_path(google_update::kRegPathClientState);
+std::wstring GetClientStateKeyPath(const bool use_medium_key) {
+ std::wstring reg_path(use_medium_key ?
+ google_update::kRegPathClientStateMedium :
+ google_update::kRegPathClientState);
reg_path.append(L"\\");
reg_path.append(google_update::kChromeGuid);
return reg_path;
}
bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
- std::wstring reg_path = GetClientStateKeyPath();
+ std::wstring reg_path = GetClientStateKeyPath(false);
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
if (!key.ReadValue(name, value)) {
RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ);
@@ -27,7 +29,7 @@ bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) {
}
bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
- std::wstring reg_path = GetClientStateKeyPath();
+ std::wstring reg_path = GetClientStateKeyPath(false);
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
std::wstring value;
if (!key.ReadValue(name, &value))
@@ -38,7 +40,7 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) {
} // namespace.
bool GoogleUpdateSettings::GetCollectStatsConsent() {
- std::wstring reg_path = GetClientStateKeyPath();
+ std::wstring reg_path = GetClientStateKeyPath(false);
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ);
DWORD value;
if (!key.ReadValueDW(google_update::kRegUsageStatsField, &value)) {
@@ -50,10 +52,15 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
}
bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
- std::wstring reg_path = GetClientStateKeyPath();
+ std::wstring reg_path = GetClientStateKeyPath(false);
RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
- DWORD value = consented ? 1 : 0;
- return key.WriteValue(google_update::kRegUsageStatsField, value);
+ return key.WriteValue(google_update::kRegUsageStatsField, consented? 1 : 0);
+}
+
+bool GoogleUpdateSettings::SetEULAConsent(bool consented) {
+ std::wstring reg_path = GetClientStateKeyPath(true);
+ RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WRITE);
+ return key.WriteValue(google_update::kRegEULAAceptedField, consented? 1 : 0);
}
bool GoogleUpdateSettings::GetBrowser(std::wstring* browser) {
@@ -75,3 +82,4 @@ bool GoogleUpdateSettings::GetReferral(std::wstring* referral) {
bool GoogleUpdateSettings::ClearReferral() {
return ClearGoogleUpdateStrKey(google_update::kRegReferralField);
}
+
diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h
index 8ae65b4..4045eba 100644
--- a/chrome/installer/util/google_update_settings.h
+++ b/chrome/installer/util/google_update_settings.h
@@ -23,6 +23,10 @@ class GoogleUpdateSettings {
// false if the setting could not be recorded.
static bool SetCollectStatsConsent(bool consented);
+ // Sets the machine-wide EULA consented flag required on OEM installs.
+ // Returns false if the setting could not be recorded.
+ static bool SetEULAConsent(bool consented);
+
// 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);