| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "net/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter( | 68 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter( |
| 69 new URLRequestContextGetter(io_thread.message_loop_proxy())); | 69 new URLRequestContextGetter(io_thread.message_loop_proxy())); |
| 70 scoped_ptr<OAuthClient> oauth_client( | 70 scoped_ptr<OAuthClient> oauth_client( |
| 71 new OAuthClient(url_request_context_getter)); | 71 new OAuthClient(url_request_context_getter)); |
| 72 | 72 |
| 73 net::URLFetcher::SetIgnoreCertificateRequests(true); | 73 net::URLFetcher::SetIgnoreCertificateRequests(true); |
| 74 | 74 |
| 75 // Create the pairing registry and native messaging host. | 75 // Create the pairing registry and native messaging host. |
| 76 scoped_refptr<protocol::PairingRegistry> pairing_registry = | 76 scoped_refptr<protocol::PairingRegistry> pairing_registry = |
| 77 CreatePairingRegistry(io_thread.message_loop_proxy()); | 77 CreatePairingRegistry(io_thread.message_loop_proxy()); |
| 78 scoped_ptr<NativeMessagingChannel::Delegate> host( | 78 |
| 79 scoped_ptr<NativeMessagingHost> host( |
| 79 new NativeMessagingHost(daemon_controller, | 80 new NativeMessagingHost(daemon_controller, |
| 80 pairing_registry, | 81 pairing_registry, |
| 81 oauth_client.Pass())); | 82 oauth_client.Pass())); |
| 82 | 83 host->Start(read_file, write_file, run_loop.QuitClosure()); |
| 83 // Set up the native messaging channel. | |
| 84 scoped_ptr<NativeMessagingChannel> channel( | |
| 85 new NativeMessagingChannel(host.Pass(), read_file, write_file)); | |
| 86 channel->Start(run_loop.QuitClosure()); | |
| 87 | 84 |
| 88 // Run the loop until channel is alive. | 85 // Run the loop until channel is alive. |
| 89 run_loop.Run(); | 86 run_loop.Run(); |
| 90 return kSuccessExitCode; | 87 return kSuccessExitCode; |
| 91 } | 88 } |
| 92 | 89 |
| 93 } // namespace remoting | 90 } // namespace remoting |
| 94 | 91 |
| 95 int main(int argc, char** argv) { | 92 int main(int argc, char** argv) { |
| 96 // This object instance is required by Chrome code (such as MessageLoop). | 93 // This object instance is required by Chrome code (such as MessageLoop). |
| 97 base::AtExitManager exit_manager; | 94 base::AtExitManager exit_manager; |
| 98 | 95 |
| 99 CommandLine::Init(argc, argv); | 96 CommandLine::Init(argc, argv); |
| 100 remoting::InitHostLogging(); | 97 remoting::InitHostLogging(); |
| 101 | 98 |
| 102 return remoting::NativeMessagingHostMain(); | 99 return remoting::NativeMessagingHostMain(); |
| 103 } | 100 } |
| OLD | NEW |