OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/security_key/remote_security_key_main.h" | 5 #include "remoting/host/security_key/remote_security_key_main.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "mojo/edk/embedder/embedder.h" |
| 17 #include "mojo/edk/embedder/scoped_ipc_support.h" |
15 #include "remoting/host/host_exit_codes.h" | 18 #include "remoting/host/host_exit_codes.h" |
16 #include "remoting/host/logging.h" | 19 #include "remoting/host/logging.h" |
17 #include "remoting/host/security_key/security_key_ipc_client.h" | 20 #include "remoting/host/security_key/security_key_ipc_client.h" |
18 #include "remoting/host/security_key/security_key_message_handler.h" | 21 #include "remoting/host/security_key/security_key_message_handler.h" |
19 | 22 |
20 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
21 #include <aclapi.h> | 24 #include <aclapi.h> |
22 #include <windows.h> | 25 #include <windows.h> |
23 | 26 |
24 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 SetStdHandle(STD_INPUT_HANDLE, nullptr); | 133 SetStdHandle(STD_INPUT_HANDLE, nullptr); |
131 SetStdHandle(STD_OUTPUT_HANDLE, nullptr); | 134 SetStdHandle(STD_OUTPUT_HANDLE, nullptr); |
132 #elif defined(OS_POSIX) | 135 #elif defined(OS_POSIX) |
133 // The files are automatically closed. | 136 // The files are automatically closed. |
134 base::File read_file(STDIN_FILENO); | 137 base::File read_file(STDIN_FILENO); |
135 base::File write_file(STDOUT_FILENO); | 138 base::File write_file(STDOUT_FILENO); |
136 #else | 139 #else |
137 #error Not implemented. | 140 #error Not implemented. |
138 #endif | 141 #endif |
139 | 142 |
| 143 mojo::edk::Init(); |
| 144 mojo::edk::ScopedIPCSupport ipc_support(base::ThreadTaskRunnerHandle::Get()); |
| 145 |
140 base::RunLoop run_loop; | 146 base::RunLoop run_loop; |
141 | 147 |
142 std::unique_ptr<SecurityKeyIpcClient> ipc_client(new SecurityKeyIpcClient()); | 148 std::unique_ptr<SecurityKeyIpcClient> ipc_client(new SecurityKeyIpcClient()); |
143 | 149 |
144 SecurityKeyMessageHandler message_handler; | 150 SecurityKeyMessageHandler message_handler; |
145 message_handler.Start(std::move(read_file), std::move(write_file), | 151 message_handler.Start(std::move(read_file), std::move(write_file), |
146 std::move(ipc_client), run_loop.QuitClosure()); | 152 std::move(ipc_client), run_loop.QuitClosure()); |
147 | 153 |
148 run_loop.Run(); | 154 run_loop.Run(); |
149 | 155 |
150 return kSuccessExitCode; | 156 return kSuccessExitCode; |
151 } | 157 } |
152 | 158 |
153 int RemoteSecurityKeyMain(int argc, char** argv) { | 159 int RemoteSecurityKeyMain(int argc, char** argv) { |
154 // This object instance is required by Chrome classes (such as MessageLoop). | 160 // This object instance is required by Chrome classes (such as MessageLoop). |
155 base::AtExitManager exit_manager; | 161 base::AtExitManager exit_manager; |
156 base::MessageLoopForIO message_loop; | 162 base::MessageLoopForIO message_loop; |
157 | 163 |
158 base::CommandLine::Init(argc, argv); | 164 base::CommandLine::Init(argc, argv); |
159 remoting::InitHostLogging(); | 165 remoting::InitHostLogging(); |
160 | 166 |
161 return StartRemoteSecurityKey(); | 167 return StartRemoteSecurityKey(); |
162 } | 168 } |
163 | 169 |
164 } // namespace remoting | 170 } // namespace remoting |
OLD | NEW |