| 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 "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/i18n/icu_util.h" | 9 #include "base/i18n/icu_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "media/base/media.h" | 12 #include "media/base/media.h" |
| 13 #include "net/socket/ssl_server_socket.h" | 13 #include "net/socket/ssl_server_socket.h" |
| 14 #include "remoting/base/breakpad.h" | 14 #include "remoting/base/breakpad.h" |
| 15 #include "remoting/base/resources.h" | 15 #include "remoting/base/resources.h" |
| 16 #include "remoting/host/host_exit_codes.h" | 16 #include "remoting/host/host_exit_codes.h" |
| 17 #include "remoting/host/it2me/it2me_native_messaging_host.h" | 17 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
| 18 #include "remoting/host/logging.h" | 18 #include "remoting/host/logging.h" |
| 19 #include "remoting/host/native_messaging/pipe_messaging_channel.h" |
| 19 #include "remoting/host/usage_stats_consent.h" | 20 #include "remoting/host/usage_stats_consent.h" |
| 20 | 21 |
| 21 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
| 22 #include <gtk/gtk.h> | 23 #include <gtk/gtk.h> |
| 23 #include <X11/Xlib.h> | 24 #include <X11/Xlib.h> |
| 24 #endif // defined(OS_LINUX) | 25 #endif // defined(OS_LINUX) |
| 25 | 26 |
| 26 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
| 27 #include "base/mac/scoped_nsautorelease_pool.h" | 28 #include "base/mac/scoped_nsautorelease_pool.h" |
| 28 #endif // defined(OS_MACOSX) | 29 #endif // defined(OS_MACOSX) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 base::MessageLoopForUI message_loop; | 111 base::MessageLoopForUI message_loop; |
| 111 base::RunLoop run_loop; | 112 base::RunLoop run_loop; |
| 112 | 113 |
| 113 scoped_refptr<AutoThreadTaskRunner> task_runner = | 114 scoped_refptr<AutoThreadTaskRunner> task_runner = |
| 114 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 115 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 115 run_loop.QuitClosure()); | 116 run_loop.QuitClosure()); |
| 116 | 117 |
| 117 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); | 118 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); |
| 118 | 119 |
| 119 // Set up the native messaging channel. | 120 // Set up the native messaging channel. |
| 120 scoped_ptr<NativeMessagingChannel> channel( | 121 scoped_ptr<PipeMessagingChannel> channel( |
| 121 new NativeMessagingChannel(read_file.Pass(), write_file.Pass())); | 122 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); |
| 122 | 123 |
| 123 scoped_ptr<It2MeNativeMessagingHost> host( | 124 scoped_ptr<It2MeNativeMessagingHost> host( |
| 124 new It2MeNativeMessagingHost( | 125 new It2MeNativeMessagingHost( |
| 125 task_runner, channel.Pass(), factory.Pass())); | 126 task_runner, |
| 127 channel.PassAs<extensions::NativeMessagingChannel>(), |
| 128 factory.Pass())); |
| 126 host->Start(run_loop.QuitClosure()); | 129 host->Start(run_loop.QuitClosure()); |
| 127 | 130 |
| 128 // Run the loop until channel is alive. | 131 // Run the loop until channel is alive. |
| 129 run_loop.Run(); | 132 run_loop.Run(); |
| 130 | 133 |
| 131 return kSuccessExitCode; | 134 return kSuccessExitCode; |
| 132 } | 135 } |
| 133 | 136 |
| 134 int It2MeNativeMessagingHostMain(int argc, char** argv) { | 137 int It2MeNativeMessagingHostMain(int argc, char** argv) { |
| 135 // This object instance is required by Chrome code (such as MessageLoop). | 138 // This object instance is required by Chrome code (such as MessageLoop). |
| 136 base::AtExitManager exit_manager; | 139 base::AtExitManager exit_manager; |
| 137 | 140 |
| 138 base::CommandLine::Init(argc, argv); | 141 base::CommandLine::Init(argc, argv); |
| 139 remoting::InitHostLogging(); | 142 remoting::InitHostLogging(); |
| 140 | 143 |
| 141 return StartIt2MeNativeMessagingHost(); | 144 return StartIt2MeNativeMessagingHost(); |
| 142 } | 145 } |
| 143 | 146 |
| 144 } // namespace remoting | 147 } // namespace remoting |
| OLD | NEW |