OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <termios.h> | 6 #include <termios.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter( | 152 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter( |
153 new remoting::URLRequestContextGetter( | 153 new remoting::URLRequestContextGetter( |
154 g_message_loop->message_loop_proxy(), | 154 g_message_loop->message_loop_proxy(), |
155 io_thread.message_loop_proxy())); | 155 io_thread.message_loop_proxy())); |
156 | 156 |
157 if (remoting::ServiceUrls::GetInstance()->ignore_urlfetcher_cert_requests()) { | 157 if (remoting::ServiceUrls::GetInstance()->ignore_urlfetcher_cert_requests()) { |
158 net::URLFetcher::SetIgnoreCertificateRequests(true); | 158 net::URLFetcher::SetIgnoreCertificateRequests(true); |
159 } | 159 } |
160 | 160 |
161 // Start the host. | 161 // Start the host. |
162 scoped_ptr<HostStarter> host_starter( | 162 scoped_ptr<HostStarter> host_starter(HostStarter::Create( |
163 HostStarter::Create( | 163 GaiaUrls::GetInstance()->oauth2_token_url(), |
164 GaiaUrls::GetInstance()->oauth2_token_url(), | 164 remoting::ServiceUrls::GetInstance()->directory_hosts_url(), |
165 remoting::ServiceUrls::GetInstance()->directory_hosts_url(), | 165 url_request_context_getter.get())); |
166 url_request_context_getter)); | |
167 if (redirect_url.empty()) { | 166 if (redirect_url.empty()) { |
168 redirect_url = remoting::GetDefaultOauthRedirectUrl(); | 167 redirect_url = remoting::GetDefaultOauthRedirectUrl(); |
169 } | 168 } |
170 host_starter->StartHost(host_name, host_pin, true, auth_code, redirect_url, | 169 host_starter->StartHost(host_name, host_pin, true, auth_code, redirect_url, |
171 base::Bind(&OnDone)); | 170 base::Bind(&OnDone)); |
172 | 171 |
173 // Run the message loop until the StartHost completion callback. | 172 // Run the message loop until the StartHost completion callback. |
174 base::RunLoop run_loop; | 173 base::RunLoop run_loop; |
175 run_loop.Run(); | 174 run_loop.Run(); |
176 | 175 |
177 g_message_loop = NULL; | 176 g_message_loop = NULL; |
178 | 177 |
179 // Destroy the HostStarter and URLRequestContextGetter before stopping the | 178 // Destroy the HostStarter and URLRequestContextGetter before stopping the |
180 // IO thread. | 179 // IO thread. |
181 host_starter.reset(); | 180 host_starter.reset(); |
182 url_request_context_getter = NULL; | 181 url_request_context_getter = NULL; |
183 | 182 |
184 io_thread.Stop(); | 183 io_thread.Stop(); |
185 | 184 |
186 return g_started ? 0 : 1; | 185 return g_started ? 0 : 1; |
187 } | 186 } |
OLD | NEW |