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/chromoting_host_context.h" |
16 #include "remoting/host/host_exit_codes.h" | 17 #include "remoting/host/host_exit_codes.h" |
17 #include "remoting/host/it2me/it2me_native_messaging_host.h" | 18 #include "remoting/host/it2me/it2me_native_messaging_host.h" |
18 #include "remoting/host/logging.h" | 19 #include "remoting/host/logging.h" |
19 #include "remoting/host/native_messaging/native_messaging_pipe.h" | 20 #include "remoting/host/native_messaging/native_messaging_pipe.h" |
20 #include "remoting/host/native_messaging/pipe_messaging_channel.h" | 21 #include "remoting/host/native_messaging/pipe_messaging_channel.h" |
21 #include "remoting/host/usage_stats_consent.h" | 22 #include "remoting/host/usage_stats_consent.h" |
22 | 23 |
23 #if defined(OS_LINUX) | 24 #if defined(OS_LINUX) |
24 #include <gtk/gtk.h> | 25 #include <gtk/gtk.h> |
25 #include <X11/Xlib.h> | 26 #include <X11/Xlib.h> |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); | 120 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); |
120 | 121 |
121 scoped_ptr<NativeMessagingPipe> native_messaging_pipe( | 122 scoped_ptr<NativeMessagingPipe> native_messaging_pipe( |
122 new NativeMessagingPipe()); | 123 new NativeMessagingPipe()); |
123 | 124 |
124 // Set up the native messaging channel. | 125 // Set up the native messaging channel. |
125 scoped_ptr<extensions::NativeMessagingChannel> channel( | 126 scoped_ptr<extensions::NativeMessagingChannel> channel( |
126 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); | 127 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); |
127 | 128 |
128 scoped_ptr<extensions::NativeMessageHost> host(new It2MeNativeMessagingHost( | 129 scoped_ptr<extensions::NativeMessageHost> host(new It2MeNativeMessagingHost( |
129 task_runner, | 130 ChromotingHostContext::Create(task_runner), |
130 factory.Pass())); | 131 factory.Pass())); |
131 | 132 |
132 host->Start(native_messaging_pipe.get()); | 133 host->Start(native_messaging_pipe.get()); |
133 | 134 |
134 native_messaging_pipe->Start( | 135 native_messaging_pipe->Start( |
135 host.Pass(), channel.Pass(), run_loop.QuitClosure()); | 136 host.Pass(), channel.Pass(), run_loop.QuitClosure()); |
136 | 137 |
137 // Run the loop until channel is alive. | 138 // Run the loop until channel is alive. |
138 run_loop.Run(); | 139 run_loop.Run(); |
139 | 140 |
140 return kSuccessExitCode; | 141 return kSuccessExitCode; |
141 } | 142 } |
142 | 143 |
143 int It2MeNativeMessagingHostMain(int argc, char** argv) { | 144 int It2MeNativeMessagingHostMain(int argc, char** argv) { |
144 // This object instance is required by Chrome code (such as MessageLoop). | 145 // This object instance is required by Chrome code (such as MessageLoop). |
145 base::AtExitManager exit_manager; | 146 base::AtExitManager exit_manager; |
146 | 147 |
147 base::CommandLine::Init(argc, argv); | 148 base::CommandLine::Init(argc, argv); |
148 remoting::InitHostLogging(); | 149 remoting::InitHostLogging(); |
149 | 150 |
150 return StartIt2MeNativeMessagingHost(); | 151 return StartIt2MeNativeMessagingHost(); |
151 } | 152 } |
152 | 153 |
153 } // namespace remoting | 154 } // namespace remoting |
OLD | NEW |