OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file defines specific implementation of BrowserDistribution class for | 5 // This file defines specific implementation of BrowserDistribution class for |
6 // Google Chrome. | 6 // Google Chrome. |
7 | 7 |
8 #include "chrome/installer/util/google_chrome_distribution.h" | 8 #include "chrome/installer/util/google_chrome_distribution.h" |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 base::IntToString(key)); | 248 base::IntToString(key)); |
249 | 249 |
250 if (base::win::GetVersion() > base::win::VERSION_XP) { | 250 if (base::win::GetVersion() > base::win::VERSION_XP) { |
251 // Make sure that in Vista and Above we have the proper DACLs so | 251 // Make sure that in Vista and Above we have the proper DACLs so |
252 // the interactive user can launch it. | 252 // the interactive user can launch it. |
253 if (!FixDACLsForExecute(setup_path)) | 253 if (!FixDACLsForExecute(setup_path)) |
254 NOTREACHED(); | 254 NOTREACHED(); |
255 } | 255 } |
256 | 256 |
257 DWORD console_id = ::WTSGetActiveConsoleSessionId(); | 257 DWORD console_id = ::WTSGetActiveConsoleSessionId(); |
258 if (console_id == 0xFFFFFFFF) | 258 if (console_id == 0xFFFFFFFF) { |
| 259 PLOG(ERROR) << __FUNCTION__ << " failed to get active session id"; |
259 return false; | 260 return false; |
| 261 } |
260 HANDLE user_token; | 262 HANDLE user_token; |
261 if (!::WTSQueryUserToken(console_id, &user_token)) | 263 if (!::WTSQueryUserToken(console_id, &user_token)) { |
| 264 PLOG(ERROR) << __FUNCTION__ << " failed to get user token for console_id " |
| 265 << console_id; |
262 return false; | 266 return false; |
| 267 } |
263 // Note: Handle inheritance must be true in order for the child process to be | 268 // Note: Handle inheritance must be true in order for the child process to be |
264 // able to use the duplicated handle above (Google Update results). | 269 // able to use the duplicated handle above (Google Update results). |
265 base::LaunchOptions options; | 270 base::LaunchOptions options; |
266 options.as_user = user_token; | 271 options.as_user = user_token; |
267 options.inherit_handles = true; | 272 options.inherit_handles = true; |
| 273 VLOG(1) << __FUNCTION__ << " launching " << cmd_line.GetCommandLineString(); |
268 bool launched = base::LaunchProcess(cmd_line, options, NULL); | 274 bool launched = base::LaunchProcess(cmd_line, options, NULL); |
269 ::CloseHandle(user_token); | 275 ::CloseHandle(user_token); |
| 276 VLOG(1) << __FUNCTION__ << " result: " << launched; |
270 return launched; | 277 return launched; |
271 } | 278 } |
272 | 279 |
273 // The plugin infobar experiment is just setting the client registry value | 280 // The plugin infobar experiment is just setting the client registry value |
274 // to one of four possible values from 10% of the elegible population, which | 281 // to one of four possible values from 10% of the elegible population, which |
275 // is defined as active users that have opted-in for sending stats. | 282 // is defined as active users that have opted-in for sending stats. |
276 // Chrome reads this value and modifies the plugin blocking and infobar | 283 // Chrome reads this value and modifies the plugin blocking and infobar |
277 // behavior accordingly. | 284 // behavior accordingly. |
278 bool DoInfobarPluginsExperiment(int dir_age_hours) { | 285 bool DoInfobarPluginsExperiment(int dir_age_hours) { |
279 std::wstring client; | 286 std::wstring client; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // | 707 // |
701 // There are three scenarios when this function is called: | 708 // There are three scenarios when this function is called: |
702 // 1- Is a per-user-install and it updated: perform the experiment | 709 // 1- Is a per-user-install and it updated: perform the experiment |
703 // 2- Is a system-install and it updated : relaunch as the interactive user | 710 // 2- Is a system-install and it updated : relaunch as the interactive user |
704 // 3- It has been re-launched from the #2 case. In this case we enter | 711 // 3- It has been re-launched from the #2 case. In this case we enter |
705 // this function with |system_install| true and a REENTRY_SYS_UPDATE status. | 712 // this function with |system_install| true and a REENTRY_SYS_UPDATE status. |
706 void GoogleChromeDistribution::LaunchUserExperiment( | 713 void GoogleChromeDistribution::LaunchUserExperiment( |
707 const FilePath& setup_path, installer::InstallStatus status, | 714 const FilePath& setup_path, installer::InstallStatus status, |
708 const Version& version, const installer::Product& product, | 715 const Version& version, const installer::Product& product, |
709 bool system_level) { | 716 bool system_level) { |
| 717 VLOG(1) << "LaunchUserExperiment status: " << status << " product: " |
| 718 << product.distribution()->GetAppShortCutName() |
| 719 << " system_level: " << system_level; |
| 720 |
710 if (system_level) { | 721 if (system_level) { |
711 if (installer::NEW_VERSION_UPDATED == status) { | 722 if (installer::NEW_VERSION_UPDATED == status) { |
712 // We need to relaunch as the interactive user. | 723 // We need to relaunch as the interactive user. |
713 LaunchSetupAsConsoleUser(setup_path, product, | 724 LaunchSetupAsConsoleUser(setup_path, product, |
714 installer::switches::kSystemLevelToast); | 725 installer::switches::kSystemLevelToast); |
715 return; | 726 return; |
716 } | 727 } |
717 } else { | 728 } else { |
718 if ((installer::NEW_VERSION_UPDATED != status) && | 729 if ((installer::NEW_VERSION_UPDATED != status) && |
719 (installer::REENTRY_SYS_UPDATE != status)) { | 730 (installer::REENTRY_SYS_UPDATE != status)) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 // we waited for chrome to exit so the uninstall would not detect chrome | 849 // we waited for chrome to exit so the uninstall would not detect chrome |
839 // running. | 850 // running. |
840 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 851 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
841 installer::switches::kSystemLevelToast); | 852 installer::switches::kSystemLevelToast); |
842 | 853 |
843 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, | 854 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, |
844 GetType())); | 855 GetType())); |
845 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 856 base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
846 } | 857 } |
847 #endif | 858 #endif |
OLD | NEW |