Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ | 5 #ifndef CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ |
| 6 #define CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ | 6 #define CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/gtest_prod_util.h" | |
| 8 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "components/signin/core/browser/profile_oauth2_token_service.h" | |
| 15 #include "device/bluetooth/bluetooth_adapter.h" | |
| 16 #include "device/bluetooth/bluetooth_advertisement.h" | |
| 17 | |
| 18 class PrefService; | |
| 9 | 19 |
| 10 namespace cryptauth { | 20 namespace cryptauth { |
| 11 class CryptAuthService; | 21 class CryptAuthService; |
| 22 class RemoteBeaconSeedFetcher; | |
| 12 } | 23 } |
| 13 | 24 |
| 14 namespace chromeos { | 25 namespace chromeos { |
| 15 | 26 |
| 27 class NetworkConnect; | |
| 28 class NetworkStateHandler; | |
| 29 | |
| 16 namespace tether { | 30 namespace tether { |
| 17 | 31 |
| 32 class ActiveHost; | |
| 33 class ActiveHostNetworkStateUpdater; | |
| 34 class BleConnectionManager; | |
| 35 class DeviceIdTetherNetworkGuidMap; | |
| 36 class HostScanner; | |
| 37 class HostScanDevicePrioritizer; | |
| 38 class LocalDeviceDataProvider; | |
| 39 class NotificationPresenter; | |
| 40 class TetherConnector; | |
| 41 class TetherHostFetcher; | |
| 42 class WifiHotspotConnector; | |
| 43 | |
| 18 // Initializes the Tether Chrome OS component. | 44 // Initializes the Tether Chrome OS component. |
| 19 // TODO(khorimoto): Implement. | 45 class Initializer : public OAuth2TokenService::Observer { |
| 20 class Initializer { | |
| 21 public: | 46 public: |
| 22 static void Initialize(cryptauth::CryptAuthService* cryptauth_service); | 47 // Starts the tether feature. |
| 48 static void Start( | |
| 49 cryptauth::CryptAuthService* cryptauth_service, | |
| 50 std::unique_ptr<NotificationPresenter> notification_presenter, | |
| 51 PrefService* pref_service, | |
| 52 ProfileOAuth2TokenService* token_service, | |
| 53 NetworkStateHandler* network_state_handler, | |
| 54 NetworkConnect* network_connect); | |
| 55 | |
| 56 // Shuts down the tether feature, destroying all internal classes. This should | |
| 57 // be called before the dependencies passed to Start() are destroyed. | |
| 58 static void Shutdown(); | |
| 23 | 59 |
| 24 private: | 60 private: |
| 61 friend class InitializerTest; | |
| 62 | |
| 25 static Initializer* instance_; | 63 static Initializer* instance_; |
| 26 | 64 |
| 27 explicit Initializer(cryptauth::CryptAuthService* cryptauth_service); | 65 Initializer(cryptauth::CryptAuthService* cryptauth_service, |
| 28 ~Initializer(); | 66 std::unique_ptr<NotificationPresenter> notification_presenter, |
| 67 PrefService* pref_service, | |
| 68 ProfileOAuth2TokenService* token_service, | |
| 69 NetworkStateHandler* network_state_handler, | |
| 70 NetworkConnect* network_connect); | |
| 71 ~Initializer() override; | |
| 72 | |
| 73 // OAuth2TokenService::Observer: | |
| 74 void OnRefreshTokensLoaded() override; | |
| 75 | |
| 76 void FetchBluetoothAdapter(); | |
| 77 void OnBluetoothAdapterFetched( | |
| 78 scoped_refptr<device::BluetoothAdapter> adapter); | |
| 79 void OnBluetoothAdapterAdvertisingIntervalSet( | |
| 80 scoped_refptr<device::BluetoothAdapter> adapter); | |
| 81 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.
| |
| 29 | 82 |
| 30 cryptauth::CryptAuthService* cryptauth_service_; | 83 cryptauth::CryptAuthService* cryptauth_service_; |
| 84 std::unique_ptr<NotificationPresenter> notification_presenter_; | |
| 85 PrefService* pref_service_; | |
| 86 ProfileOAuth2TokenService* token_service_; | |
| 87 NetworkStateHandler* network_state_handler_; | |
| 88 NetworkConnect* network_connect_; | |
| 89 | |
| 90 std::unique_ptr<TetherHostFetcher> tether_host_fetcher_; | |
| 91 std::unique_ptr<LocalDeviceDataProvider> local_device_data_provider_; | |
| 92 std::unique_ptr<cryptauth::RemoteBeaconSeedFetcher> | |
| 93 remote_beacon_seed_fetcher_; | |
| 94 std::unique_ptr<BleConnectionManager> ble_connection_manager_; | |
| 95 std::unique_ptr<HostScanDevicePrioritizer> host_scan_device_prioritizer_; | |
| 96 std::unique_ptr<WifiHotspotConnector> wifi_hotspot_connector_; | |
| 97 std::unique_ptr<ActiveHost> active_host_; | |
| 98 std::unique_ptr<ActiveHostNetworkStateUpdater> | |
| 99 active_host_network_state_updater_; | |
| 100 std::unique_ptr<DeviceIdTetherNetworkGuidMap> | |
| 101 device_id_tether_network_guid_map_; | |
| 102 std::unique_ptr<TetherConnector> tether_connector_; | |
| 103 std::unique_ptr<HostScanner> host_scanner_; | |
| 104 | |
| 105 base::WeakPtrFactory<Initializer> weak_ptr_factory_; | |
| 31 | 106 |
| 32 DISALLOW_COPY_AND_ASSIGN(Initializer); | 107 DISALLOW_COPY_AND_ASSIGN(Initializer); |
| 33 }; | 108 }; |
| 34 | 109 |
| 35 } // namespace tether | 110 } // namespace tether |
| 36 | 111 |
| 37 } // namespace chromeos | 112 } // namespace chromeos |
| 38 | 113 |
| 39 #endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ | 114 #endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ |
| OLD | NEW |