Chromium Code Reviews| Index: chromeos/components/tether/initializer.h |
| diff --git a/chromeos/components/tether/initializer.h b/chromeos/components/tether/initializer.h |
| index 76a98a972f601fb8fdc4d0d8154a543dacac24c6..247f28aceb3cc8bc2c5fc5e5989a58aa3335a234 100644 |
| --- a/chromeos/components/tether/initializer.h |
| +++ b/chromeos/components/tether/initializer.h |
| @@ -5,29 +5,104 @@ |
| #ifndef CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ |
| #define CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ |
| +#include <memory> |
| + |
| +#include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "components/signin/core/browser/profile_oauth2_token_service.h" |
| +#include "device/bluetooth/bluetooth_adapter.h" |
| +#include "device/bluetooth/bluetooth_advertisement.h" |
| + |
| +class PrefService; |
| namespace cryptauth { |
| class CryptAuthService; |
| +class RemoteBeaconSeedFetcher; |
| } |
| namespace chromeos { |
| +class NetworkConnect; |
| +class NetworkStateHandler; |
| + |
| namespace tether { |
| +class ActiveHost; |
| +class ActiveHostNetworkStateUpdater; |
| +class BleConnectionManager; |
| +class DeviceIdTetherNetworkGuidMap; |
| +class HostScanner; |
| +class HostScanDevicePrioritizer; |
| +class LocalDeviceDataProvider; |
| +class NotificationPresenter; |
| +class TetherConnector; |
| +class TetherHostFetcher; |
| +class WifiHotspotConnector; |
| + |
| // Initializes the Tether Chrome OS component. |
| -// TODO(khorimoto): Implement. |
| -class Initializer { |
| +class Initializer : public OAuth2TokenService::Observer { |
| public: |
| - static void Initialize(cryptauth::CryptAuthService* cryptauth_service); |
| + // Starts the tether feature. |
| + static void Start( |
| + cryptauth::CryptAuthService* cryptauth_service, |
| + std::unique_ptr<NotificationPresenter> notification_presenter, |
| + PrefService* pref_service, |
| + ProfileOAuth2TokenService* token_service, |
| + NetworkStateHandler* network_state_handler, |
| + NetworkConnect* network_connect); |
| + |
| + // Shuts down the tether feature, destroying all internal classes. This should |
| + // be called before the dependencies passed to Start() are destroyed. |
| + static void Shutdown(); |
| private: |
| + friend class InitializerTest; |
| + |
| static Initializer* instance_; |
| - explicit Initializer(cryptauth::CryptAuthService* cryptauth_service); |
| - ~Initializer(); |
| + Initializer(cryptauth::CryptAuthService* cryptauth_service, |
| + std::unique_ptr<NotificationPresenter> notification_presenter, |
| + PrefService* pref_service, |
| + ProfileOAuth2TokenService* token_service, |
| + NetworkStateHandler* network_state_handler, |
| + NetworkConnect* network_connect); |
| + ~Initializer() override; |
| + |
| + // OAuth2TokenService::Observer: |
| + void OnRefreshTokensLoaded() override; |
| + |
| + void FetchBluetoothAdapter(); |
| + void OnBluetoothAdapterFetched( |
| + scoped_refptr<device::BluetoothAdapter> adapter); |
| + void OnBluetoothAdapterAdvertisingIntervalSet( |
| + scoped_refptr<device::BluetoothAdapter> adapter); |
| + void IntervalErrorCallback(device::BluetoothAdvertisement::ErrorCode status); |
|
Ryan Hansberry
2017/04/11 15:48:40
Please change the name of this to reflect the new
Kyle Horimoto
2017/04/11 16:28:13
Done.
|
| cryptauth::CryptAuthService* cryptauth_service_; |
| + std::unique_ptr<NotificationPresenter> notification_presenter_; |
| + PrefService* pref_service_; |
| + ProfileOAuth2TokenService* token_service_; |
| + NetworkStateHandler* network_state_handler_; |
| + NetworkConnect* network_connect_; |
| + |
| + std::unique_ptr<TetherHostFetcher> tether_host_fetcher_; |
| + std::unique_ptr<LocalDeviceDataProvider> local_device_data_provider_; |
| + std::unique_ptr<cryptauth::RemoteBeaconSeedFetcher> |
| + remote_beacon_seed_fetcher_; |
| + std::unique_ptr<BleConnectionManager> ble_connection_manager_; |
| + std::unique_ptr<HostScanDevicePrioritizer> host_scan_device_prioritizer_; |
| + std::unique_ptr<WifiHotspotConnector> wifi_hotspot_connector_; |
| + std::unique_ptr<ActiveHost> active_host_; |
| + std::unique_ptr<ActiveHostNetworkStateUpdater> |
| + active_host_network_state_updater_; |
| + std::unique_ptr<DeviceIdTetherNetworkGuidMap> |
| + device_id_tether_network_guid_map_; |
| + std::unique_ptr<TetherConnector> tether_connector_; |
| + std::unique_ptr<HostScanner> host_scanner_; |
| + |
| + base::WeakPtrFactory<Initializer> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(Initializer); |
| }; |