Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: remoting/host/setup/daemon_installer_win.cc

Issue 780653003: Revert of Upgrade the windows specific version of LaunchProcess to avoid raw handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/zygote/zygote_linux.cc ('k') | win8/test/metro_registration_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "remoting/host/setup/daemon_installer_win.h" 5 #include "remoting/host/setup/daemon_installer_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ~DaemonCommandLineInstallerWin(); 95 ~DaemonCommandLineInstallerWin();
96 96
97 // DaemonInstallerWin implementation. 97 // DaemonInstallerWin implementation.
98 virtual void Install() override; 98 virtual void Install() override;
99 99
100 // base::win::ObjectWatcher::Delegate implementation. 100 // base::win::ObjectWatcher::Delegate implementation.
101 virtual void OnObjectSignaled(HANDLE object) override; 101 virtual void OnObjectSignaled(HANDLE object) override;
102 102
103 private: 103 private:
104 // Handle of the launched process. 104 // Handle of the launched process.
105 base::Process process_; 105 base::win::ScopedHandle process_;
106 106
107 // Used to determine when the launched process terminates. 107 // Used to determine when the launched process terminates.
108 base::win::ObjectWatcher process_watcher_; 108 base::win::ObjectWatcher process_watcher_;
109 }; 109 };
110 110
111 DaemonComInstallerWin::DaemonComInstallerWin( 111 DaemonComInstallerWin::DaemonComInstallerWin(
112 const ScopedComPtr<IDispatch>& update3, 112 const ScopedComPtr<IDispatch>& update3,
113 const CompletionCallback& done) 113 const CompletionCallback& done)
114 : DaemonInstallerWin(done), 114 : DaemonInstallerWin(done),
115 update3_(update3), 115 update3_(update3),
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 // Launch the updater process and wait for its termination. 295 // Launch the updater process and wait for its termination.
296 base::string16 command_line = base::WideToUTF16( 296 base::string16 command_line = base::WideToUTF16(
297 base::StringPrintf(kGoogleUpdateCommandLineFormat, 297 base::StringPrintf(kGoogleUpdateCommandLineFormat,
298 google_update.c_str(), 298 google_update.c_str(),
299 kHostOmahaAppid, 299 kHostOmahaAppid,
300 kOmahaLanguage)); 300 kOmahaLanguage));
301 301
302 base::LaunchOptions options; 302 base::LaunchOptions options;
303 process_ = base::LaunchProcess(command_line, options); 303 if (!base::LaunchProcess(command_line, options, &process_)) {
304 if (!process_.IsValid()) {
305 result = GetLastError(); 304 result = GetLastError();
306 Done(HRESULT_FROM_WIN32(result)); 305 Done(HRESULT_FROM_WIN32(result));
307 return; 306 return;
308 } 307 }
309 308
310 if (!process_watcher_.StartWatching(process_.Handle(), this)) { 309 if (!process_watcher_.StartWatching(process_.Get(), this)) {
311 result = GetLastError(); 310 result = GetLastError();
312 Done(HRESULT_FROM_WIN32(result)); 311 Done(HRESULT_FROM_WIN32(result));
313 return; 312 return;
314 } 313 }
315 } 314 }
316 315
317 void DaemonCommandLineInstallerWin::OnObjectSignaled(HANDLE object) { 316 void DaemonCommandLineInstallerWin::OnObjectSignaled(HANDLE object) {
318 // Check if the updater process returned success. 317 // Check if the updater process returned success.
319 DWORD exit_code; 318 DWORD exit_code;
320 if (GetExitCodeProcess(process_.Handle(), &exit_code) && exit_code == 0) { 319 if (GetExitCodeProcess(process_.Get(), &exit_code) && exit_code == 0) {
321 Done(S_OK); 320 Done(S_OK);
322 } else { 321 } else {
323 Done(E_FAIL); 322 Done(E_FAIL);
324 } 323 }
325 } 324 }
326 325
327 DaemonInstallerWin::DaemonInstallerWin(const CompletionCallback& done) 326 DaemonInstallerWin::DaemonInstallerWin(const CompletionCallback& done)
328 : done_(done) { 327 : done_(done) {
329 } 328 }
330 329
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 HWND parent = GetAncestor(window, GA_PARENT); 402 HWND parent = GetAncestor(window, GA_PARENT);
404 if (parent == NULL) { 403 if (parent == NULL) {
405 return window; 404 return window;
406 } 405 }
407 406
408 window = parent; 407 window = parent;
409 } 408 }
410 } 409 }
411 410
412 } // namespace remoting 411 } // namespace remoting
OLDNEW
« no previous file with comments | « content/zygote/zygote_linux.cc ('k') | win8/test/metro_registration_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698