Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: chromeos/components/tether/initializer.h

Issue 2801353002: [CrOS Tether] Fill out the Initializer class. Tether will now initialize fully once the flag is ena… (Closed)
Patch Set: Added missing dep. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/components/tether/host_scanner_unittest.cc ('k') | chromeos/components/tether/initializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/components/tether/initializer.h
diff --git a/chromeos/components/tether/initializer.h b/chromeos/components/tether/initializer.h
index 76a98a972f601fb8fdc4d0d8154a543dacac24c6..01fe741039a3bb8e77b127424b93cd4c9628c65a 100644
--- a/chromeos/components/tether/initializer.h
+++ b/chromeos/components/tether/initializer.h
@@ -5,29 +5,108 @@
#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);
+ // Initializes the tether feature.
+ static void Init(
+ 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 Init() 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 OnBluetoothAdapterAdvertisingIntervalError(
+ device::BluetoothAdvertisement::ErrorCode status);
cryptauth::CryptAuthService* cryptauth_service_;
+ std::unique_ptr<NotificationPresenter> notification_presenter_;
+ PrefService* pref_service_;
+ ProfileOAuth2TokenService* token_service_;
+ NetworkStateHandler* network_state_handler_;
+ NetworkConnect* network_connect_;
+
+ // Declare new objects in the order that they will be created during
+ // initialization to ensure that they are destroyed in the correct order. This
+ // order will be enforced by InitializerTest.TestCreateAndDestroy.
+ 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);
};
« no previous file with comments | « chromeos/components/tether/host_scanner_unittest.cc ('k') | chromeos/components/tether/initializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698