| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // to do so. That is the process that needs the key. | 133 // to do so. That is the process that needs the key. |
| 134 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); | 134 const CommandLine& current_cmd_line = *CommandLine::ForCurrentProcess(); |
| 135 std::string key(installer::switches::kToastResultsKey); | 135 std::string key(installer::switches::kToastResultsKey); |
| 136 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); | 136 std::string toast_key = current_cmd_line.GetSwitchValueASCII(key); |
| 137 if (!toast_key.empty()) { | 137 if (!toast_key.empty()) { |
| 138 cmd_line.AppendSwitchASCII(key, toast_key); | 138 cmd_line.AppendSwitchASCII(key, toast_key); |
| 139 | 139 |
| 140 // Use handle inheritance to make sure the duplicated toast results key | 140 // Use handle inheritance to make sure the duplicated toast results key |
| 141 // gets inherited by the child process. | 141 // gets inherited by the child process. |
| 142 return base::LaunchAppWithHandleInheritance( | 142 return base::LaunchAppWithHandleInheritance( |
| 143 cmd_line.command_line_string(), false, false, NULL); | 143 cmd_line.GetCommandLineString(), false, false, NULL); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 return base::LaunchApp(cmd_line.command_line_string(), | 147 return base::LaunchApp(cmd_line.GetCommandLineString(), |
| 148 false, false, NULL); | 148 false, false, NULL); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // For System level installs, setup.exe lives in the system temp, which | 151 // For System level installs, setup.exe lives in the system temp, which |
| 152 // is normally c:\windows\temp. In many cases files inside this folder | 152 // is normally c:\windows\temp. In many cases files inside this folder |
| 153 // are not accessible for execution by regular user accounts. | 153 // are not accessible for execution by regular user accounts. |
| 154 // This function changes the permisions so that any authenticated user | 154 // This function changes the permisions so that any authenticated user |
| 155 // can launch |exe| later on. This function should only be called if the | 155 // can launch |exe| later on. This function should only be called if the |
| 156 // code is running at the system level. | 156 // code is running at the system level. |
| 157 bool FixDACLsForExecute(const FilePath& exe) { | 157 bool FixDACLsForExecute(const FilePath& exe) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 DWORD console_id = ::WTSGetActiveConsoleSessionId(); | 226 DWORD console_id = ::WTSGetActiveConsoleSessionId(); |
| 227 if (console_id == 0xFFFFFFFF) | 227 if (console_id == 0xFFFFFFFF) |
| 228 return false; | 228 return false; |
| 229 HANDLE user_token; | 229 HANDLE user_token; |
| 230 if (!::WTSQueryUserToken(console_id, &user_token)) | 230 if (!::WTSQueryUserToken(console_id, &user_token)) |
| 231 return false; | 231 return false; |
| 232 // Note: Handle inheritance must be true in order for the child process to be | 232 // Note: Handle inheritance must be true in order for the child process to be |
| 233 // able to use the duplicated handle above (Google Update results). | 233 // able to use the duplicated handle above (Google Update results). |
| 234 bool launched = base::LaunchAppAsUser(user_token, | 234 bool launched = base::LaunchAppAsUser(user_token, |
| 235 cmd_line.command_line_string(), | 235 cmd_line.GetCommandLineString(), |
| 236 false, NULL, true, true); | 236 false, NULL, true, true); |
| 237 ::CloseHandle(user_token); | 237 ::CloseHandle(user_token); |
| 238 return launched; | 238 return launched; |
| 239 } | 239 } |
| 240 | 240 |
| 241 // The plugin infobar experiment is just setting the client registry value | 241 // The plugin infobar experiment is just setting the client registry value |
| 242 // to one of four possible values from 10% of the elegible population, which | 242 // to one of four possible values from 10% of the elegible population, which |
| 243 // is defined as active users that have opted-in for sending stats. | 243 // is defined as active users that have opted-in for sending stats. |
| 244 // Chrome reads this value and modifies the plugin blocking and infobar | 244 // Chrome reads this value and modifies the plugin blocking and infobar |
| 245 // behavior accordingly. | 245 // behavior accordingly. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 options.AppendSwitchNative(switches::kTryChromeAgain, | 759 options.AppendSwitchNative(switches::kTryChromeAgain, |
| 760 base::IntToString16(flavor)); | 760 base::IntToString16(flavor)); |
| 761 if (has_welcome_url) { | 761 if (has_welcome_url) { |
| 762 // Prepend the url with a space. | 762 // Prepend the url with a space. |
| 763 std::wstring url(GetWelcomeBackUrl()); | 763 std::wstring url(GetWelcomeBackUrl()); |
| 764 options.AppendArg("--"); | 764 options.AppendArg("--"); |
| 765 options.AppendArgNative(url); | 765 options.AppendArgNative(url); |
| 766 // The command line should now have the url added as: | 766 // The command line should now have the url added as: |
| 767 // "chrome.exe -- <url>" | 767 // "chrome.exe -- <url>" |
| 768 DCHECK_NE(std::wstring::npos, | 768 DCHECK_NE(std::wstring::npos, |
| 769 options.command_line_string().find(L" -- " + url)); | 769 options.GetCommandLineString().find(L" -- " + url)); |
| 770 } | 770 } |
| 771 // Launch chrome now. It will show the toast UI. | 771 // Launch chrome now. It will show the toast UI. |
| 772 int32 exit_code = 0; | 772 int32 exit_code = 0; |
| 773 if (!installation.LaunchChromeAndWait(application_path, options, &exit_code)) | 773 if (!installation.LaunchChromeAndWait(application_path, options, &exit_code)) |
| 774 return; | 774 return; |
| 775 | 775 |
| 776 // The chrome process has exited, figure out what happened. | 776 // The chrome process has exited, figure out what happened. |
| 777 const wchar_t* outcome = NULL; | 777 const wchar_t* outcome = NULL; |
| 778 switch (exit_code) { | 778 switch (exit_code) { |
| 779 case ResultCodes::NORMAL_EXIT: | 779 case ResultCodes::NORMAL_EXIT: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 799 // we waited for chrome to exit so the uninstall would not detect chrome | 799 // we waited for chrome to exit so the uninstall would not detect chrome |
| 800 // running. | 800 // running. |
| 801 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( | 801 bool system_level_toast = CommandLine::ForCurrentProcess()->HasSwitch( |
| 802 installer::switches::kSystemLevelToast); | 802 installer::switches::kSystemLevelToast); |
| 803 | 803 |
| 804 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, | 804 CommandLine cmd(InstallUtil::GetChromeUninstallCmd(system_level_toast, |
| 805 GetType())); | 805 GetType())); |
| 806 base::LaunchProcess(cmd, base::LaunchOptions()); | 806 base::LaunchProcess(cmd, base::LaunchOptions()); |
| 807 } | 807 } |
| 808 #endif | 808 #endif |
| OLD | NEW |