| 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( | |
| 79 new NativeMessagingHost(daemon_controller, | |
| 80 pairing_registry, | |
| 81 oauth_client.Pass())); | |
| 82 | 78 |
| 83 // Set up the native messaging channel. | 79 // Set up the native messaging channel. |
| 84 scoped_ptr<NativeMessagingChannel> channel( | 80 scoped_ptr<NativeMessagingChannel> channel( |
| 85 new NativeMessagingChannel(host.Pass(), read_file, write_file)); | 81 new NativeMessagingChannel(read_file, write_file)); |
| 86 channel->Start(run_loop.QuitClosure()); | 82 |
| 83 scoped_ptr<NativeMessagingHost> host( |
| 84 new NativeMessagingHost(channel.Pass(), |
| 85 daemon_controller, |
| 86 pairing_registry, |
| 87 oauth_client.Pass())); |
| 88 host->Start(run_loop.QuitClosure()); |
| 87 | 89 |
| 88 // Run the loop until channel is alive. | 90 // Run the loop until channel is alive. |
| 89 run_loop.Run(); | 91 run_loop.Run(); |
| 90 return kSuccessExitCode; | 92 return kSuccessExitCode; |
| 91 } | 93 } |
| 92 | 94 |
| 93 } // namespace remoting | 95 } // namespace remoting |
| 94 | 96 |
| 95 int main(int argc, char** argv) { | 97 int main(int argc, char** argv) { |
| 96 // This object instance is required by Chrome code (such as MessageLoop). | 98 // This object instance is required by Chrome code (such as MessageLoop). |
| 97 base::AtExitManager exit_manager; | 99 base::AtExitManager exit_manager; |
| 98 | 100 |
| 99 CommandLine::Init(argc, argv); | 101 CommandLine::Init(argc, argv); |
| 100 remoting::InitHostLogging(); | 102 remoting::InitHostLogging(); |
| 101 | 103 |
| 102 return remoting::NativeMessagingHostMain(); | 104 return remoting::NativeMessagingHostMain(); |
| 103 } | 105 } |
| OLD | NEW |