OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 "components/browser_watcher/watcher_client_win.h" | 5 #include "components/browser_watcher/watcher_client_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 base::HandlesToInheritVector to_inherit; | 41 base::HandlesToInheritVector to_inherit; |
42 base::LaunchOptions options; | 42 base::LaunchOptions options; |
43 options.start_hidden = true; | 43 options.start_hidden = true; |
44 if (use_legacy_launch_) { | 44 if (use_legacy_launch_) { |
45 // Launch the child process inheriting all handles on XP. | 45 // Launch the child process inheriting all handles on XP. |
46 options.inherit_handles = true; | 46 options.inherit_handles = true; |
47 } else { | 47 } else { |
48 // Launch the child process inheriting only |self| on | 48 // Launch the child process inheriting only |self| on |
49 // Vista and better. | 49 // Vista and better. |
50 to_inherit.push_back(self.Handle()); | 50 to_inherit.push_back(self.Handle()); |
| 51 to_inherit.insert(to_inherit.end(), inherited_handles_.begin(), |
| 52 inherited_handles_.end()); |
51 options.handles_to_inherit = &to_inherit; | 53 options.handles_to_inherit = &to_inherit; |
52 } | 54 } |
53 | 55 |
54 process_ = base::LaunchProcess(cmd_line, options); | 56 process_ = base::LaunchProcess(cmd_line, options); |
55 if (!process_.IsValid()) | 57 if (!process_.IsValid()) |
56 LOG(ERROR) << "Failed to launch browser watcher."; | 58 LOG(ERROR) << "Failed to launch browser watcher."; |
57 } | 59 } |
58 | 60 |
| 61 void WatcherClient::AddInheritedHandle(HANDLE handle) { |
| 62 inherited_handles_.push_back(handle); |
| 63 } |
| 64 |
59 } // namespace browser_watcher | 65 } // namespace browser_watcher |
OLD | NEW |