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 "remoting/host/setup/host_starter.h" | 5 #include "remoting/host/setup/host_starter.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "google_apis/google_api_keys.h" | 10 #include "google_apis/google_api_keys.h" |
11 #include "remoting/host/pin_hash.h" | 11 #include "remoting/host/pin_hash.h" |
12 #include "remoting/host/setup/oauth_helper.h" | 12 #include "remoting/host/setup/oauth_helper.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 const int kMaxGetTokensRetries = 3; | 15 const int kMaxGetTokensRetries = 3; |
16 } // namespace | 16 } // namespace |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 HostStarter::HostStarter( | 20 HostStarter::HostStarter( |
21 scoped_ptr<gaia::GaiaOAuthClient> oauth_client, | 21 scoped_ptr<gaia::GaiaOAuthClient> oauth_client, |
22 scoped_ptr<remoting::ServiceClient> service_client, | 22 scoped_ptr<remoting::ServiceClient> service_client, |
23 scoped_ptr<remoting::DaemonController> daemon_controller) | 23 scoped_ptr<remoting::DaemonController> daemon_controller) |
24 : oauth_client_(oauth_client.Pass()), | 24 : oauth_client_(oauth_client.Pass()), |
25 service_client_(service_client.Pass()), | 25 service_client_(service_client.Pass()), |
26 daemon_controller_(daemon_controller.Pass()), | 26 daemon_controller_(daemon_controller.Pass()), |
27 consent_to_data_collection_(false), | 27 consent_to_data_collection_(false), |
28 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 28 weak_ptr_factory_(this), |
29 weak_ptr_(weak_ptr_factory_.GetWeakPtr()) { | 29 weak_ptr_(weak_ptr_factory_.GetWeakPtr()) { |
30 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 30 main_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
31 } | 31 } |
32 | 32 |
33 HostStarter::~HostStarter() { | 33 HostStarter::~HostStarter() { |
34 } | 34 } |
35 | 35 |
36 scoped_ptr<HostStarter> HostStarter::Create( | 36 scoped_ptr<HostStarter> HostStarter::Create( |
37 const std::string& oauth2_token_url, | 37 const std::string& oauth2_token_url, |
38 const std::string& chromoting_hosts_url, | 38 const std::string& chromoting_hosts_url, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 main_task_runner_->PostTask(FROM_HERE, base::Bind( | 175 main_task_runner_->PostTask(FROM_HERE, base::Bind( |
176 &HostStarter::OnHostUnregistered, weak_ptr_)); | 176 &HostStarter::OnHostUnregistered, weak_ptr_)); |
177 return; | 177 return; |
178 } | 178 } |
179 CompletionCallback cb = on_done_; | 179 CompletionCallback cb = on_done_; |
180 on_done_.Reset(); | 180 on_done_.Reset(); |
181 cb.Run(START_ERROR); | 181 cb.Run(START_ERROR); |
182 } | 182 } |
183 | 183 |
184 } // namespace remoting | 184 } // namespace remoting |
OLD | NEW |