summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run.cc
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 02:45:17 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 02:45:17 +0000
commit16b8085518a82444fac7c251356cdc87a5720c9a (patch)
tree0a785590e34fcdfa8fd1f89f4295abc4f041c0c6 /chrome/browser/first_run.cc
parent23ea641fcaf68070e9768a8b252e7adea473f17e (diff)
downloadchromium_src-16b8085518a82444fac7c251356cdc87a5720c9a.zip
chromium_src-16b8085518a82444fac7c251356cdc87a5720c9a.tar.gz
chromium_src-16b8085518a82444fac7c251356cdc87a5720c9a.tar.bz2
Process the EULA distro param, to direct chrome to show the EULA dialog
- This is the EULA post installation case. Other cases possible. - Chrome waits forever until user dismises the dialog - Chrome will exit ipso-facto if user declines. BUG=1468838 Review URL: http://codereview.chromium.org/19601 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run.cc')
-rwxr-xr-xchrome/browser/first_run.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/first_run.cc b/chrome/browser/first_run.cc
index 8522a8b..e1cabb2 100755
--- a/chrome/browser/first_run.cc
+++ b/chrome/browser/first_run.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/first_run.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/object_watcher.h"
@@ -112,6 +113,22 @@ bool InvokeGoogleUpdateForRename() {
return false;
}
+bool LaunchSetupWithParam(const std::wstring& param, int* ret_code) {
+ std::wstring exe_path;
+ if (!PathService::Get(base::DIR_EXE, &exe_path))
+ return false;
+ file_util::AppendToPath(&exe_path, installer_util::kSetupExe);
+ base::ProcessHandle ph;
+ CommandLine cl(exe_path);
+ cl.AppendSwitch(param);
+ if (!base::LaunchApp(cl, false, false, &ph))
+ return false;
+ DWORD wr = ::WaitForSingleObject(ph, INFINITE);
+ if (wr != WAIT_OBJECT_0)
+ return false;
+ return (TRUE == ::GetExitCodeProcess(ph, reinterpret_cast<DWORD*>(ret_code)));
+}
+
} // namespace
bool FirstRun::IsChromeFirstRun() {
@@ -189,6 +206,18 @@ bool FirstRun::ProcessMasterPreferences(
if (parse_result & installer_util::MASTER_PROFILE_ERROR)
return true;
+ if (parse_result & installer_util::MASTER_PROFILE_REQUIRE_EULA) {
+ // 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.
+ int retcode = 0;
+ if (!LaunchSetupWithParam(installer_util::switches::kShowEula, &retcode) ||
+ (retcode != installer_util::EULA_ACCEPTED)) {
+ LOG(WARNING) << "EULA rejected. Fast exit.";
+ ::ExitProcess(1);
+ }
+ }
+
std::wstring user_prefs = GetDefaultPrefFilePath(true, user_data_dir);
if (user_prefs.empty())
return true;