OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/it2me/it2me_native_messaging_host_main.h" | 5 #include "remoting/host/it2me/it2me_native_messaging_host_main.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/task_scheduler/task_scheduler.h" | 14 #include "base/task_scheduler/task_scheduler.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "remoting/base/auto_thread_task_runner.h" | 16 #include "remoting/base/auto_thread_task_runner.h" |
17 #include "remoting/base/breakpad.h" | 17 #include "remoting/base/breakpad.h" |
18 #include "remoting/host/chromoting_host_context.h" | 18 #include "remoting/host/chromoting_host_context.h" |
19 #include "remoting/host/host_exit_codes.h" | 19 #include "remoting/host/host_exit_codes.h" |
20 #include "remoting/host/it2me/it2me_native_messaging_host.h" | 20 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
21 #include "remoting/host/logging.h" | 21 #include "remoting/host/logging.h" |
22 #include "remoting/host/native_messaging/native_messaging_pipe.h" | 22 #include "remoting/host/native_messaging/native_messaging_pipe.h" |
23 #include "remoting/host/native_messaging/pipe_messaging_channel.h" | 23 #include "remoting/host/native_messaging/pipe_messaging_channel.h" |
| 24 #include "remoting/host/policy_watcher.h" |
24 #include "remoting/host/resources.h" | 25 #include "remoting/host/resources.h" |
25 #include "remoting/host/usage_stats_consent.h" | 26 #include "remoting/host/usage_stats_consent.h" |
26 | 27 |
27 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
28 #include <gtk/gtk.h> | 29 #include <gtk/gtk.h> |
29 #include <X11/Xlib.h> | 30 #include <X11/Xlib.h> |
30 | 31 |
31 #include "base/linux_util.h" | 32 #include "base/linux_util.h" |
32 #endif // defined(OS_LINUX) | 33 #endif // defined(OS_LINUX) |
33 | 34 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 std::unique_ptr<NativeMessagingPipe> native_messaging_pipe( | 180 std::unique_ptr<NativeMessagingPipe> native_messaging_pipe( |
180 new NativeMessagingPipe()); | 181 new NativeMessagingPipe()); |
181 | 182 |
182 // Set up the native messaging channel. | 183 // Set up the native messaging channel. |
183 std::unique_ptr<extensions::NativeMessagingChannel> channel( | 184 std::unique_ptr<extensions::NativeMessagingChannel> channel( |
184 new PipeMessagingChannel(std::move(read_file), std::move(write_file))); | 185 new PipeMessagingChannel(std::move(read_file), std::move(write_file))); |
185 | 186 |
186 std::unique_ptr<ChromotingHostContext> context = | 187 std::unique_ptr<ChromotingHostContext> context = |
187 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner( | 188 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner( |
188 message_loop.task_runner(), run_loop.QuitClosure())); | 189 message_loop.task_runner(), run_loop.QuitClosure())); |
| 190 std::unique_ptr<PolicyWatcher> policy_watcher = |
| 191 PolicyWatcher::Create(nullptr, context->file_task_runner()); |
189 std::unique_ptr<extensions::NativeMessageHost> host( | 192 std::unique_ptr<extensions::NativeMessageHost> host( |
190 new It2MeNativeMessagingHost(needs_elevation, /*policy_service=*/nullptr, | 193 new It2MeNativeMessagingHost(needs_elevation, std::move(policy_watcher), |
191 std::move(context), std::move(factory))); | 194 std::move(context), std::move(factory))); |
192 | 195 |
193 host->Start(native_messaging_pipe.get()); | 196 host->Start(native_messaging_pipe.get()); |
194 | 197 |
195 native_messaging_pipe->Start(std::move(host), std::move(channel)); | 198 native_messaging_pipe->Start(std::move(host), std::move(channel)); |
196 | 199 |
197 // Run the loop until channel is alive. | 200 // Run the loop until channel is alive. |
198 run_loop.Run(); | 201 run_loop.Run(); |
199 | 202 |
200 // Block until tasks blocking shutdown have completed their execution. | 203 // Block until tasks blocking shutdown have completed their execution. |
201 base::TaskScheduler::GetInstance()->Shutdown(); | 204 base::TaskScheduler::GetInstance()->Shutdown(); |
202 | 205 |
203 return kSuccessExitCode; | 206 return kSuccessExitCode; |
204 } | 207 } |
205 | 208 |
206 } // namespace remoting | 209 } // namespace remoting |
OLD | NEW |