diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 03:45:24 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 03:45:24 +0000 |
commit | f8ec0d584c9b476d7dcb919e769a9e66fc666e62 (patch) | |
tree | 8bb1120ea4a735f6c382a43d78e1c02e0e63ce7e /chrome/browser/first_run | |
parent | cf9e57411d02f9328328ea4f4ec81741076891bc (diff) | |
download | chromium_src-f8ec0d584c9b476d7dcb919e769a9e66fc666e62.zip chromium_src-f8ec0d584c9b476d7dcb919e769a9e66fc666e62.tar.gz chromium_src-f8ec0d584c9b476d7dcb919e769a9e66fc666e62.tar.bz2 |
Do not show the EULA if it has already been accepted by the user in another user data dir.
BUG=131033
TEST=install system-level chrome with require_eula in master prefs and eulaaccepted=0 in the ClientState key. nuke all user data dirs (including the metro one). now launch desktop chrome and accept the eula. make chrome the default browser and launch into metro. notice that it works.
Review URL: https://chromiumcodereview.appspot.com/10539153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index a66fd8c..31461fa 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -171,6 +171,25 @@ bool LaunchSetupWithParam(const std::string& param, return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code))); } +// Returns true if the EULA is required but has not been accepted by this user. +// The EULA is considered having been accepted if the user has gotten past +// first run in the "other" environment (desktop or metro). +bool IsEulaNotAccepted(installer::MasterPreferences* install_prefs) { + bool value = false; + if (install_prefs->GetBool(installer::master_preferences::kRequireEula, + &value) && value) { + // Check for a first run sentinel in the alternate user data dir. + FilePath alt_user_data_dir; + if (!PathService::Get(chrome::DIR_ALT_USER_DATA, &alt_user_data_dir) || + !file_util::DirectoryExists(alt_user_data_dir) || + !file_util::PathExists(alt_user_data_dir.AppendASCII( + first_run::internal::kSentinelFile))) { + return true; + } + } + return false; +} + // Writes the EULA to a temporary file, returned in |*eula_path|, and returns // true if successful. bool WriteEULAtoTempFile(FilePath* eula_path) { @@ -188,9 +207,7 @@ bool WriteEULAtoTempFile(FilePath* eula_path) { } void ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { - bool value = false; - if (install_prefs->GetBool(installer::master_preferences::kRequireEula, - &value) && value) { + if (IsEulaNotAccepted(install_prefs)) { // 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. |