Index: chrome/installer/setup/setup_main.cc |
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc |
index c101bb5f6c9b8a211c41538a8b3149921406e498..d5073cd56eb5f1cfc1eed59714f2142b1451a68a 100644 |
--- a/chrome/installer/setup/setup_main.cc |
+++ b/chrome/installer/setup/setup_main.cc |
@@ -21,10 +21,12 @@ |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
#include "base/win/registry.h" |
+#include "base/win/scoped_comptr.h" |
#include "base/win/scoped_handle.h" |
#include "base/win/win_util.h" |
#include "base/win/windows_version.h" |
#include "breakpad/src/client/windows/handler/exception_handler.h" |
+#include "chrome/common/chrome_paths.h" |
grt (UTC plus 2)
2012/09/20 15:58:31
why?
robertshield
2012/09/21 01:24:43
Done.
|
#include "chrome/common/chrome_switches.h" |
#include "chrome/installer/setup/chrome_frame_quick_enable.h" |
#include "chrome/installer/setup/chrome_frame_ready_mode.h" |
@@ -1031,6 +1033,65 @@ installer::InstallStatus ShowEULADialog(const string16& inner_frame) { |
return installer::EULA_ACCEPTED; |
} |
+// Populates |path| with the path to |file| in the sentinel directory. This is |
+// the application directory for user-level installs, and the default user data |
+// dir for system-level installs. Returns false on error. |
+bool GetSentinelFilePath(const char* file, |
grt (UTC plus 2)
2012/09/20 15:58:31
please move this into installer_util so that it ca
robertshield
2012/09/21 01:24:43
The reason I didn't is that the implementations ar
grt (UTC plus 2)
2012/09/21 01:35:41
Ah, I see. Sigh. I guess this is okay, although
|
+ BrowserDistribution* dist, |
+ FilePath* path) { |
+ FilePath exe_path; |
+ if (!PathService::Get(base::DIR_EXE, &exe_path)) |
+ return false; |
+ |
+ if (InstallUtil::IsPerUserInstall(exe_path.value().c_str())) { |
+ *path = exe_path; |
+ } else { |
+ std::vector<FilePath> user_data_dir_paths; |
+ installer::GetChromeUserDataPaths(dist, &user_data_dir_paths); |
+ |
+ if (!user_data_dir_paths.empty()) |
+ *path = user_data_dir_paths[0]; |
+ else |
+ return false; |
+ } |
+ |
+ *path = path->AppendASCII(file); |
+ return true; |
+} |
+ |
+// Creates the sentinel indicating that the EULA was required and has been |
+// accepted. |
+bool CreateEULASentinel(BrowserDistribution* dist) { |
+ FilePath eula_sentinel; |
+ if (!GetSentinelFilePath(installer::kEULASentinelFile, dist, &eula_sentinel)) |
+ return false; |
+ return file_util::WriteFile(eula_sentinel, "", 0) != -1; |
+} |
+ |
+void ActivateMetroChrome() { |
+ // Check to see if we're per-user or not. Need to do this since we may |
+ // not have been invoked with --system-level even for a machine install. |
+ wchar_t exe_path[MAX_PATH * 2] = {0}; |
grt (UTC plus 2)
2012/09/20 15:58:31
nit: {0} -> {}
robertshield
2012/09/21 01:24:43
Done.
|
+ GetModuleFileName(NULL, exe_path, arraysize(exe_path)); |
+ bool is_per_user_install = InstallUtil::IsPerUserInstall(exe_path); |
+ |
+ string16 app_model_id = |
+ ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(), |
+ is_per_user_install); |
+ |
+ base::win::ScopedComPtr<IApplicationActivationManager> activator; |
+ HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager); |
+ if (SUCCEEDED(hr)) { |
+ DWORD pid = 0; |
+ hr = activator->ActivateApplication( |
+ app_model_id.c_str(), L"", AO_NONE, &pid); |
grt (UTC plus 2)
2012/09/20 15:58:31
note that the version of this in process_singleton
robertshield
2012/09/21 01:24:43
Done.
|
+ } |
+ |
+ if (FAILED(hr)) { |
+ VLOG(1) << "Tried and failed to launch Metro Chrome."; |
grt (UTC plus 2)
2012/09/20 15:58:31
replace 1090 - 1092 with:
LOG_IF(ERROR, FAILED(hr)
robertshield
2012/09/21 01:24:43
Done.
|
+ } |
+} |
+ |
// This method processes any command line options that make setup.exe do |
// various tasks other than installation (renaming chrome.exe, showing eula |
// among others). This function returns true if any such command line option |
@@ -1090,9 +1151,16 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, |
string16 inner_frame = |
cmd_line.GetSwitchValueNative(installer::switches::kShowEula); |
*exit_code = ShowEULADialog(inner_frame); |
+ |
if (installer::EULA_REJECTED != *exit_code) { |
grt (UTC plus 2)
2012/09/20 15:58:31
the user is left on the desktop upon rejection? d
robertshield
2012/09/21 01:24:43
Hrm.. good question, I don't know. They were not n
grt (UTC plus 2)
2012/09/21 01:35:41
da
|
- GoogleUpdateSettings::SetEULAConsent( |
- original_state, BrowserDistribution::GetDistribution(), true); |
+ if (GoogleUpdateSettings::SetEULAConsent( |
+ original_state, BrowserDistribution::GetDistribution(), true)) { |
+ CreateEULASentinel(BrowserDistribution::GetDistribution()); |
+ } |
+ // For a metro-originated launch, we now need to launch back into metro. |
+ if (cmd_line.HasSwitch(installer::switches::kShowEulaForMetro)) { |
grt (UTC plus 2)
2012/09/20 15:58:31
nit: no braces
robertshield
2012/09/21 01:24:43
Done.
|
+ ActivateMetroChrome(); |
+ } |
} |
} else if (cmd_line.HasSwitch( |
installer::switches::kConfigureUserSettings)) { |