Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chromeos/components/tether/tether_host_fetcher.h" | 5 #include "chromeos/components/tether/tether_host_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "components/cryptauth/cryptauth_device_manager.h" | 9 #include "components/cryptauth/cryptauth_device_manager.h" |
| 10 #include "components/cryptauth/cryptauth_enrollment_manager.h" | |
| 10 #include "components/cryptauth/cryptauth_service.h" | 11 #include "components/cryptauth/cryptauth_service.h" |
| 11 #include "components/cryptauth/remote_device_loader.h" | 12 #include "components/cryptauth/remote_device_loader.h" |
| 12 #include "components/cryptauth/secure_message_delegate.h" | 13 #include "components/cryptauth/secure_message_delegate.h" |
| 13 | 14 |
| 14 namespace chromeos { | 15 namespace chromeos { |
| 15 | 16 |
| 16 namespace tether { | 17 namespace tether { |
| 17 | 18 |
| 18 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( | 19 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( |
| 19 const TetherHostListCallback& list_callback) | 20 const TetherHostListCallback& list_callback) |
| 20 : device_id(""), list_callback(list_callback) {} | 21 : device_id(""), list_callback(list_callback) {} |
| 21 | 22 |
| 22 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( | 23 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( |
| 23 const std::string& device_id, | 24 const std::string& device_id, |
| 24 const TetherHostCallback& single_callback) | 25 const TetherHostCallback& single_callback) |
| 25 : device_id(device_id), single_callback(single_callback) {} | 26 : device_id(device_id), single_callback(single_callback) {} |
| 26 | 27 |
| 27 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( | 28 TetherHostFetcher::TetherHostFetchRequest::TetherHostFetchRequest( |
| 28 const TetherHostFetchRequest& other) | 29 const TetherHostFetchRequest& other) |
| 29 : device_id(other.device_id), | 30 : device_id(other.device_id), |
| 30 list_callback(other.list_callback), | 31 list_callback(other.list_callback), |
| 31 single_callback(other.single_callback) {} | 32 single_callback(other.single_callback) {} |
| 32 | 33 |
| 33 TetherHostFetcher::TetherHostFetchRequest::~TetherHostFetchRequest() {} | 34 TetherHostFetcher::TetherHostFetchRequest::~TetherHostFetchRequest() {} |
| 34 | 35 |
| 35 TetherHostFetcher::TetherHostFetcher( | 36 TetherHostFetcher::TetherHostFetcher( |
| 37 cryptauth::CryptAuthService* cryptauth_service) | |
| 38 : TetherHostFetcher(cryptauth_service->GetAccountId(), | |
| 39 cryptauth_service_->GetCryptAuthEnrollmentManager() | |
|
Ryan Hansberry
2017/04/07 23:08:55
Oops, this should be cryptauth_service. cryptauth_
Kyle Horimoto
2017/04/07 23:33:10
Done.
| |
| 40 ->GetUserPrivateKey(), | |
| 41 cryptauth_service, | |
| 42 cryptauth_service->GetCryptAuthDeviceManager()) {} | |
| 43 | |
| 44 TetherHostFetcher::TetherHostFetcher( | |
| 36 const std::string& user_id, | 45 const std::string& user_id, |
| 37 const std::string& user_private_key, | 46 const std::string& user_private_key, |
| 38 cryptauth::CryptAuthService* cryptauth_service, | 47 cryptauth::CryptAuthService* cryptauth_service, |
| 39 cryptauth::CryptAuthDeviceManager* device_manager) | 48 cryptauth::CryptAuthDeviceManager* device_manager) |
| 40 : user_id_(user_id), | 49 : user_id_(user_id), |
| 41 user_private_key_(user_private_key), | 50 user_private_key_(user_private_key), |
| 42 cryptauth_service_(cryptauth_service), | 51 cryptauth_service_(cryptauth_service), |
| 43 device_manager_(device_manager), | 52 device_manager_(device_manager), |
| 44 weak_ptr_factory_(this) {} | 53 weak_ptr_factory_(this) {} |
| 45 | 54 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 112 |
| 104 if (!has_run_callback) { | 113 if (!has_run_callback) { |
| 105 request.single_callback.Run(nullptr); | 114 request.single_callback.Run(nullptr); |
| 106 } | 115 } |
| 107 } | 116 } |
| 108 } | 117 } |
| 109 | 118 |
| 110 } // namespace tether | 119 } // namespace tether |
| 111 | 120 |
| 112 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |