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> |
| 8 |
7 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
10 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
12 #include "build/build_config.h" | 14 #include "build/build_config.h" |
13 #include "net/socket/ssl_server_socket.h" | 15 #include "net/socket/ssl_server_socket.h" |
14 #include "remoting/base/breakpad.h" | 16 #include "remoting/base/breakpad.h" |
15 #include "remoting/host/chromoting_host_context.h" | 17 #include "remoting/host/chromoting_host_context.h" |
16 #include "remoting/host/host_exit_codes.h" | 18 #include "remoting/host/host_exit_codes.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 base::MessageLoopForUI message_loop; | 117 base::MessageLoopForUI message_loop; |
116 base::RunLoop run_loop; | 118 base::RunLoop run_loop; |
117 | 119 |
118 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); | 120 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); |
119 | 121 |
120 scoped_ptr<NativeMessagingPipe> native_messaging_pipe( | 122 scoped_ptr<NativeMessagingPipe> native_messaging_pipe( |
121 new NativeMessagingPipe()); | 123 new NativeMessagingPipe()); |
122 | 124 |
123 // Set up the native messaging channel. | 125 // Set up the native messaging channel. |
124 scoped_ptr<extensions::NativeMessagingChannel> channel( | 126 scoped_ptr<extensions::NativeMessagingChannel> channel( |
125 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); | 127 new PipeMessagingChannel(std::move(read_file), std::move(write_file))); |
126 | 128 |
127 scoped_ptr<ChromotingHostContext> context = | 129 scoped_ptr<ChromotingHostContext> context = |
128 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner( | 130 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner( |
129 message_loop.task_runner(), run_loop.QuitClosure())); | 131 message_loop.task_runner(), run_loop.QuitClosure())); |
130 scoped_ptr<extensions::NativeMessageHost> host( | 132 scoped_ptr<extensions::NativeMessageHost> host( |
131 new It2MeNativeMessagingHost(context.Pass(), factory.Pass())); | 133 new It2MeNativeMessagingHost(std::move(context), std::move(factory))); |
132 | 134 |
133 host->Start(native_messaging_pipe.get()); | 135 host->Start(native_messaging_pipe.get()); |
134 | 136 |
135 native_messaging_pipe->Start(host.Pass(), channel.Pass()); | 137 native_messaging_pipe->Start(std::move(host), std::move(channel)); |
136 | 138 |
137 // Run the loop until channel is alive. | 139 // Run the loop until channel is alive. |
138 run_loop.Run(); | 140 run_loop.Run(); |
139 | 141 |
140 return kSuccessExitCode; | 142 return kSuccessExitCode; |
141 } | 143 } |
142 | 144 |
143 int It2MeNativeMessagingHostMain(int argc, char** argv) { | 145 int It2MeNativeMessagingHostMain(int argc, char** argv) { |
144 // This object instance is required by Chrome code (such as MessageLoop). | 146 // This object instance is required by Chrome code (such as MessageLoop). |
145 base::AtExitManager exit_manager; | 147 base::AtExitManager exit_manager; |
146 | 148 |
147 base::CommandLine::Init(argc, argv); | 149 base::CommandLine::Init(argc, argv); |
148 remoting::InitHostLogging(); | 150 remoting::InitHostLogging(); |
149 | 151 |
150 return StartIt2MeNativeMessagingHost(); | 152 return StartIt2MeNativeMessagingHost(); |
151 } | 153 } |
152 | 154 |
153 } // namespace remoting | 155 } // namespace remoting |
OLD | NEW |