| 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 #include "chrome_frame/ready_mode/internal/registry_ready_mode_state.h" | 5 #include "chrome_frame/ready_mode/internal/registry_ready_mode_state.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Attempts to launch a command using the ProcessLauncher. Returns a handle to | 53 // Attempts to launch a command using the ProcessLauncher. Returns a handle to |
| 54 // the launched process, which the caller is responsible for closing, or NULL | 54 // the launched process, which the caller is responsible for closing, or NULL |
| 55 // upon failure. | 55 // upon failure. |
| 56 HANDLE LaunchCommandViaProcessLauncher(const std::wstring& command_field) { | 56 HANDLE LaunchCommandViaProcessLauncher(const std::wstring& command_field) { |
| 57 HANDLE launched_process = NULL; | 57 HANDLE launched_process = NULL; |
| 58 | 58 |
| 59 scoped_ptr<CommandLine> command_line( | 59 scoped_ptr<CommandLine> command_line( |
| 60 chrome_launcher::CreateUpdateCommandLine(command_field)); | 60 chrome_launcher::CreateUpdateCommandLine(command_field)); |
| 61 | 61 |
| 62 if (command_line != NULL) | 62 if (command_line != NULL) { |
| 63 base::LaunchApp(*command_line, false, true, &launched_process); | 63 base::LaunchOptions options; |
| 64 options.start_hidden = true; |
| 65 options.process_handle = &launched_process; |
| 66 base::LaunchProcess(*command_line, options); |
| 67 } |
| 64 | 68 |
| 65 return launched_process; | 69 return launched_process; |
| 66 } | 70 } |
| 67 | 71 |
| 68 // Waits for the provided process to exit, and verifies that its exit code | 72 // Waits for the provided process to exit, and verifies that its exit code |
| 69 // corresponds to one of the known "success" codes for the installer. If the | 73 // corresponds to one of the known "success" codes for the installer. If the |
| 70 // exit code cannot be retrieved, or if it signals failure, returns false. | 74 // exit code cannot be retrieved, or if it signals failure, returns false. |
| 71 bool CheckProcessExitCode(HANDLE handle) { | 75 bool CheckProcessExitCode(HANDLE handle) { |
| 72 // TODO(erikwright): Use RegisterWaitForSingleObject to wait | 76 // TODO(erikwright): Use RegisterWaitForSingleObject to wait |
| 73 // asynchronously. | 77 // asynchronously. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 245 |
| 242 void RegistryReadyModeState::PermanentlyDeclineChromeFrame() { | 246 void RegistryReadyModeState::PermanentlyDeclineChromeFrame() { |
| 243 if (LaunchAndCheckCommand(google_update::kRegCFOptOutCmdField)) | 247 if (LaunchAndCheckCommand(google_update::kRegCFOptOutCmdField)) |
| 244 RefreshStateAndNotify(); | 248 RefreshStateAndNotify(); |
| 245 } | 249 } |
| 246 | 250 |
| 247 void RegistryReadyModeState::AcceptChromeFrame() { | 251 void RegistryReadyModeState::AcceptChromeFrame() { |
| 248 if (LaunchAndCheckCommand(google_update::kRegCFOptInCmdField)) | 252 if (LaunchAndCheckCommand(google_update::kRegCFOptInCmdField)) |
| 249 NotifyObserver(); | 253 NotifyObserver(); |
| 250 } | 254 } |
| OLD | NEW |