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