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/setup/me2me_native_messaging_host_main.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host_main.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file.h" |
9 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/threading/thread.h" |
13 #include "net/url_request/url_fetcher.h" | 15 #include "net/url_request/url_fetcher.h" |
14 #include "remoting/base/breakpad.h" | 16 #include "remoting/base/breakpad.h" |
15 #include "remoting/base/url_request_context_getter.h" | 17 #include "remoting/base/url_request_context_getter.h" |
16 #include "remoting/host/host_exit_codes.h" | 18 #include "remoting/host/host_exit_codes.h" |
17 #include "remoting/host/logging.h" | 19 #include "remoting/host/logging.h" |
| 20 #include "remoting/host/native_messaging/pipe_messaging_channel.h" |
18 #include "remoting/host/pairing_registry_delegate.h" | 21 #include "remoting/host/pairing_registry_delegate.h" |
19 #include "remoting/host/setup/me2me_native_messaging_host.h" | 22 #include "remoting/host/setup/me2me_native_messaging_host.h" |
20 #include "remoting/host/usage_stats_consent.h" | 23 #include "remoting/host/usage_stats_consent.h" |
21 | 24 |
22 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
23 #include "base/mac/scoped_nsautorelease_pool.h" | 26 #include "base/mac/scoped_nsautorelease_pool.h" |
24 #endif // defined(OS_MACOSX) | 27 #endif // defined(OS_MACOSX) |
25 | 28 |
26 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
27 #include "base/win/registry.h" | 30 #include "base/win/registry.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 234 |
232 pairing_registry = new PairingRegistry( | 235 pairing_registry = new PairingRegistry( |
233 io_thread.task_runner(), | 236 io_thread.task_runner(), |
234 delegate.PassAs<PairingRegistry::Delegate>()); | 237 delegate.PassAs<PairingRegistry::Delegate>()); |
235 #else // defined(OS_WIN) | 238 #else // defined(OS_WIN) |
236 pairing_registry = | 239 pairing_registry = |
237 CreatePairingRegistry(io_thread.task_runner()); | 240 CreatePairingRegistry(io_thread.task_runner()); |
238 #endif // !defined(OS_WIN) | 241 #endif // !defined(OS_WIN) |
239 | 242 |
240 // Set up the native messaging channel. | 243 // Set up the native messaging channel. |
241 scoped_ptr<NativeMessagingChannel> channel( | 244 scoped_ptr<extensions::NativeMessagingChannel> channel( |
242 new NativeMessagingChannel(read_file.Pass(), write_file.Pass())); | 245 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); |
243 | 246 |
244 // Create the native messaging host. | 247 // Create the native messaging host. |
245 scoped_ptr<Me2MeNativeMessagingHost> host( | 248 scoped_ptr<Me2MeNativeMessagingHost> host( |
246 new Me2MeNativeMessagingHost( | 249 new Me2MeNativeMessagingHost( |
247 needs_elevation, | 250 needs_elevation, |
248 static_cast<intptr_t>(native_view_handle), | 251 static_cast<intptr_t>(native_view_handle), |
249 channel.Pass(), | 252 channel.Pass(), |
250 daemon_controller, | 253 daemon_controller, |
251 pairing_registry, | 254 pairing_registry, |
252 oauth_client.Pass())); | 255 oauth_client.Pass())); |
253 host->Start(run_loop.QuitClosure()); | 256 host->Start(run_loop.QuitClosure()); |
254 | 257 |
255 // Run the loop until channel is alive. | 258 // Run the loop until channel is alive. |
256 run_loop.Run(); | 259 run_loop.Run(); |
257 return kSuccessExitCode; | 260 return kSuccessExitCode; |
258 } | 261 } |
259 | 262 |
260 int Me2MeNativeMessagingHostMain(int argc, char** argv) { | 263 int Me2MeNativeMessagingHostMain(int argc, char** argv) { |
261 // This object instance is required by Chrome code (such as MessageLoop). | 264 // This object instance is required by Chrome code (such as MessageLoop). |
262 base::AtExitManager exit_manager; | 265 base::AtExitManager exit_manager; |
263 | 266 |
264 base::CommandLine::Init(argc, argv); | 267 base::CommandLine::Init(argc, argv); |
265 remoting::InitHostLogging(); | 268 remoting::InitHostLogging(); |
266 | 269 |
267 return StartMe2MeNativeMessagingHost(); | 270 return StartMe2MeNativeMessagingHost(); |
268 } | 271 } |
269 | 272 |
270 } // namespace remoting | 273 } // namespace remoting |
OLD | NEW |