| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 12 #include "base/i18n/icu_util.h" | 14 #include "base/i18n/icu_util.h" |
| 13 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 15 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 17 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 18 #include "net/url_request/url_fetcher.h" | 20 #include "net/url_request/url_fetcher.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 243 } |
| 242 } | 244 } |
| 243 | 245 |
| 244 // Initialize the pairing registry delegate and set the root keys. | 246 // Initialize the pairing registry delegate and set the root keys. |
| 245 scoped_ptr<PairingRegistryDelegateWin> delegate( | 247 scoped_ptr<PairingRegistryDelegateWin> delegate( |
| 246 new PairingRegistryDelegateWin()); | 248 new PairingRegistryDelegateWin()); |
| 247 if (!delegate->SetRootKeys(privileged.Take(), unprivileged.Take())) | 249 if (!delegate->SetRootKeys(privileged.Take(), unprivileged.Take())) |
| 248 return kInitializationFailed; | 250 return kInitializationFailed; |
| 249 | 251 |
| 250 pairing_registry = | 252 pairing_registry = |
| 251 new PairingRegistry(io_thread.task_runner(), delegate.Pass()); | 253 new PairingRegistry(io_thread.task_runner(), std::move(delegate)); |
| 252 #else // defined(OS_WIN) | 254 #else // defined(OS_WIN) |
| 253 pairing_registry = | 255 pairing_registry = |
| 254 CreatePairingRegistry(io_thread.task_runner()); | 256 CreatePairingRegistry(io_thread.task_runner()); |
| 255 #endif // !defined(OS_WIN) | 257 #endif // !defined(OS_WIN) |
| 256 | 258 |
| 257 // Set up the native messaging channel. | 259 // Set up the native messaging channel. |
| 258 scoped_ptr<extensions::NativeMessagingChannel> channel( | 260 scoped_ptr<extensions::NativeMessagingChannel> channel( |
| 259 new PipeMessagingChannel(read_file.Pass(), write_file.Pass())); | 261 new PipeMessagingChannel(std::move(read_file), std::move(write_file))); |
| 260 | 262 |
| 261 // Create the native messaging host. | 263 // Create the native messaging host. |
| 262 scoped_ptr<Me2MeNativeMessagingHost> host( | 264 scoped_ptr<Me2MeNativeMessagingHost> host(new Me2MeNativeMessagingHost( |
| 263 new Me2MeNativeMessagingHost( | 265 needs_elevation, static_cast<intptr_t>(native_view_handle), |
| 264 needs_elevation, | 266 std::move(channel), daemon_controller, pairing_registry, |
| 265 static_cast<intptr_t>(native_view_handle), | 267 std::move(oauth_client))); |
| 266 channel.Pass(), | |
| 267 daemon_controller, | |
| 268 pairing_registry, | |
| 269 oauth_client.Pass())); | |
| 270 host->Start(run_loop.QuitClosure()); | 268 host->Start(run_loop.QuitClosure()); |
| 271 | 269 |
| 272 // Run the loop until channel is alive. | 270 // Run the loop until channel is alive. |
| 273 run_loop.Run(); | 271 run_loop.Run(); |
| 274 return kSuccessExitCode; | 272 return kSuccessExitCode; |
| 275 } | 273 } |
| 276 | 274 |
| 277 int Me2MeNativeMessagingHostMain(int argc, char** argv) { | 275 int Me2MeNativeMessagingHostMain(int argc, char** argv) { |
| 278 // This object instance is required by Chrome code (such as MessageLoop). | 276 // This object instance is required by Chrome code (such as MessageLoop). |
| 279 base::AtExitManager exit_manager; | 277 base::AtExitManager exit_manager; |
| 280 | 278 |
| 281 base::CommandLine::Init(argc, argv); | 279 base::CommandLine::Init(argc, argv); |
| 282 remoting::InitHostLogging(); | 280 remoting::InitHostLogging(); |
| 283 | 281 |
| 284 return StartMe2MeNativeMessagingHost(); | 282 return StartMe2MeNativeMessagingHost(); |
| 285 } | 283 } |
| 286 | 284 |
| 287 } // namespace remoting | 285 } // namespace remoting |
| OLD | NEW |