Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: chrome/browser/first_run/first_run_win.cc

Issue 10539153: Do not show the EULA if it has already been accepted by the user in another user data dir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run_win.cc
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index a66fd8c9631a935484c58bd87fd0b415980f8e13..ae5feb9d10b0701603ea088b66f97f19a2b9a139 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -16,6 +16,7 @@
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/object_watcher.h"
+#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -35,6 +36,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/worker_thread_ticker.h"
#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/master_preferences.h"
@@ -171,6 +173,31 @@ bool LaunchSetupWithParam(const std::string& param,
return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code)));
}
+// The EULA is considered to have not yet been accepted if both of the following
+// are true:
+// 1) ClientState\<guid>\eulaaccepted is present and has a value of 0
+// AND
+// 2) ClientStateMedium\<guid>\eulaaccepted is not present OR is present
+// and has a value of 0.
+bool IsEulaNotAccepted() {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
robertshield 2012/06/14 02:50:06 nit: double spaces
grt (UTC plus 2) 2012/06/14 03:39:00 Done.
+ DWORD eula_accepted = 1;
+ base::win::RegKey reg_key;
+ if ((reg_key.Open(HKEY_LOCAL_MACHINE, dist->GetStateKey().c_str(),
+ KEY_QUERY_VALUE) == ERROR_SUCCESS) &&
+ (reg_key.ReadValueDW(google_update::kRegEULAAceptedField,
+ &eula_accepted) == ERROR_SUCCESS) &&
+ (eula_accepted == 0)) {
+ // Google Update says that the EULA has not been accepted. Check that
+ // Chrome hasn't written its acceptance value into ClientStateMedium.
+ if (reg_key.Open(HKEY_LOCAL_MACHINE, dist->GetStateMediumKey().c_str(),
+ KEY_QUERY_VALUE) == ERROR_SUCCESS) {
+ reg_key.ReadValueDW(google_update::kRegEULAAceptedField, &eula_accepted);
+ }
+ }
+ return eula_accepted == 0;
+}
+
// Writes the EULA to a temporary file, returned in |*eula_path|, and returns
// true if successful.
bool WriteEULAtoTempFile(FilePath* eula_path) {
@@ -190,7 +217,7 @@ bool WriteEULAtoTempFile(FilePath* eula_path) {
void ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
bool value = false;
if (install_prefs->GetBool(installer::master_preferences::kRequireEula,
grt (UTC plus 2) 2012/06/14 02:09:52 i'm tempted to get rid of this check for require_e
robertshield 2012/06/14 02:50:06 If require_eula is not present and the eulaaccepte
grt (UTC plus 2) 2012/06/14 03:39:00 Done.
- &value) && value) {
+ &value) && value && IsEulaNotAccepted()) {
// Show the post-installation EULA. This is done by setup.exe and the
// result determines if we continue or not. We wait here until the user
// dismisses the dialog.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698