Chromium Code Reviews| Index: chromeos/components/tether/local_device_data_provider.h |
| diff --git a/chromeos/components/tether/local_device_data_provider.h b/chromeos/components/tether/local_device_data_provider.h |
| index 4125049aaf53c703151d28b9a9598428cc5e6619..169fb725639e5f0c5c7bbf2ce76cffa88b12755d 100644 |
| --- a/chromeos/components/tether/local_device_data_provider.h |
| +++ b/chromeos/components/tether/local_device_data_provider.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H |
| -#define CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H |
| +#ifndef CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H_ |
| +#define CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H_ |
| #include <memory> |
| #include <string> |
| @@ -14,9 +14,9 @@ |
| namespace cryptauth { |
| class BeaconSeed; |
| -class ExternalDeviceInfo; |
| class CryptAuthDeviceManager; |
| class CryptAuthEnrollmentManager; |
| +class CryptAuthService; |
| } |
| namespace chromeos { |
| @@ -27,10 +27,8 @@ namespace tether { |
| // code is running) for the current user (i.e., the one which is logged-in). |
| class LocalDeviceDataProvider { |
| public: |
| - LocalDeviceDataProvider( |
| - const cryptauth::CryptAuthDeviceManager* cryptauth_device_manager, |
| - const cryptauth::CryptAuthEnrollmentManager* |
| - cryptauth_enrollment_manager); |
| + explicit LocalDeviceDataProvider( |
| + cryptauth::CryptAuthService* cryptauth_service); |
| virtual ~LocalDeviceDataProvider(); |
| // Fetches the public key and/or the beacon seeds for the local device. |
| @@ -40,43 +38,17 @@ class LocalDeviceDataProvider { |
| std::string* public_key_out, |
| std::vector<cryptauth::BeaconSeed>* beacon_seeds_out) const; |
| + protected: |
| + LocalDeviceDataProvider( |
| + const cryptauth::CryptAuthDeviceManager* cryptauth_device_manager, |
| + const cryptauth::CryptAuthEnrollmentManager* |
| + cryptauth_enrollment_manager); |
| + |
| private: |
| friend class LocalDeviceDataProviderTest; |
| - class LocalDeviceDataProviderDelegate { |
| - public: |
| - virtual ~LocalDeviceDataProviderDelegate() {} |
| - virtual std::string GetUserPublicKey() const = 0; |
| - virtual std::vector<cryptauth::ExternalDeviceInfo> GetSyncedDevices() |
| - const = 0; |
| - }; |
| - |
| - class LocalDeviceDataProviderDelegateImpl |
| - : public LocalDeviceDataProviderDelegate { |
| - public: |
| - LocalDeviceDataProviderDelegateImpl( |
| - const cryptauth::CryptAuthDeviceManager* cryptauth_device_manager, |
| - const cryptauth::CryptAuthEnrollmentManager* |
| - cryptauth_enrollment_manager); |
| - ~LocalDeviceDataProviderDelegateImpl() override; |
| - |
| - std::string GetUserPublicKey() const override; |
| - std::vector<cryptauth::ExternalDeviceInfo> GetSyncedDevices() |
| - const override; |
| - |
| - private: |
| - // Not owned and must outlive this instance. |
| - const cryptauth::CryptAuthDeviceManager* const cryptauth_device_manager_; |
| - |
| - // Not owned and must outlive this instance. |
| - const cryptauth::CryptAuthEnrollmentManager* const |
| - cryptauth_enrollment_manager_; |
| - }; |
| - |
| - LocalDeviceDataProvider( |
| - std::unique_ptr<LocalDeviceDataProviderDelegate> delegate); |
| - |
| - std::unique_ptr<LocalDeviceDataProviderDelegate> delegate_; |
| + const cryptauth::CryptAuthDeviceManager* cryptauth_device_manager_; |
| + const cryptauth::CryptAuthEnrollmentManager* cryptauth_enrollment_manager_; |
|
Ryan Hansberry
2017/04/07 18:53:40
Woo so much simpler :D
Kyle Horimoto
2017/04/07 23:33:10
Yep! This refactor is especially awesome for this
|
| DISALLOW_COPY_AND_ASSIGN(LocalDeviceDataProvider); |
| }; |
| @@ -85,4 +57,4 @@ class LocalDeviceDataProvider { |
| } // namespace chromeos |
| -#endif // CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H |
| +#endif // CHROMEOS_COMPONENTS_TETHER_LOCAL_DEVICE_DATA_PROVIDER_H_ |