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

Side by Side Diff: chromeos/components/tether/initializer.h

Issue 2821103003: Remove the configuration of Tether-associated Wi-Fi networks once connectivity is lost. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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> 8 #include <memory>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "components/prefs/pref_registry_simple.h" 14 #include "components/prefs/pref_registry_simple.h"
15 #include "components/signin/core/browser/profile_oauth2_token_service.h" 15 #include "components/signin/core/browser/profile_oauth2_token_service.h"
16 #include "device/bluetooth/bluetooth_adapter.h" 16 #include "device/bluetooth/bluetooth_adapter.h"
17 #include "device/bluetooth/bluetooth_advertisement.h" 17 #include "device/bluetooth/bluetooth_advertisement.h"
18 18
19 class PrefService; 19 class PrefService;
20 20
21 namespace cryptauth { 21 namespace cryptauth {
22 class CryptAuthService; 22 class CryptAuthService;
23 class RemoteBeaconSeedFetcher; 23 class RemoteBeaconSeedFetcher;
24 } 24 }
25 25
26 namespace chromeos { 26 namespace chromeos {
27 27
28 class ManagedNetworkConfigurationHandler;
28 class NetworkConnect; 29 class NetworkConnect;
29 class NetworkStateHandler; 30 class NetworkStateHandler;
30 31
31 namespace tether { 32 namespace tether {
32 33
33 class ActiveHost; 34 class ActiveHost;
34 class ActiveHostNetworkStateUpdater; 35 class ActiveHostNetworkStateUpdater;
35 class BleConnectionManager; 36 class BleConnectionManager;
36 class DeviceIdTetherNetworkGuidMap; 37 class DeviceIdTetherNetworkGuidMap;
37 class HostScanner; 38 class HostScanner;
38 class HostScanDevicePrioritizer; 39 class HostScanDevicePrioritizer;
39 class LocalDeviceDataProvider; 40 class LocalDeviceDataProvider;
40 class NotificationPresenter; 41 class NotificationPresenter;
41 class TetherConnector; 42 class TetherConnector;
42 class TetherHostFetcher; 43 class TetherHostFetcher;
44 class TetherNetworkDisconnectionHandler;
43 class WifiHotspotConnector; 45 class WifiHotspotConnector;
44 46
45 // Initializes the Tether Chrome OS component. 47 // Initializes the Tether Chrome OS component.
46 class Initializer : public OAuth2TokenService::Observer { 48 class Initializer : public OAuth2TokenService::Observer {
47 public: 49 public:
48 // Initializes the tether feature. 50 // Initializes the tether feature.
49 static void Init( 51 static void Init(
50 cryptauth::CryptAuthService* cryptauth_service, 52 cryptauth::CryptAuthService* cryptauth_service,
51 std::unique_ptr<NotificationPresenter> notification_presenter, 53 std::unique_ptr<NotificationPresenter> notification_presenter,
52 PrefService* pref_service, 54 PrefService* pref_service,
53 ProfileOAuth2TokenService* token_service, 55 ProfileOAuth2TokenService* token_service,
54 NetworkStateHandler* network_state_handler, 56 NetworkStateHandler* network_state_handler,
57 ManagedNetworkConfigurationHandler* managed_network_configuration_handler,
55 NetworkConnect* network_connect); 58 NetworkConnect* network_connect);
56 59
57 // Shuts down the tether feature, destroying all internal classes. This should 60 // Shuts down the tether feature, destroying all internal classes. This should
58 // be called before the dependencies passed to Init() are destroyed. 61 // be called before the dependencies passed to Init() are destroyed.
59 static void Shutdown(); 62 static void Shutdown();
60 63
61 static void RegisterProfilePrefs(PrefRegistrySimple* registry); 64 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
62 65
63 private: 66 private:
64 friend class InitializerTest; 67 friend class InitializerTest;
65 68
66 static Initializer* instance_; 69 static Initializer* instance_;
67 70
68 Initializer(cryptauth::CryptAuthService* cryptauth_service, 71 Initializer(
69 std::unique_ptr<NotificationPresenter> notification_presenter, 72 cryptauth::CryptAuthService* cryptauth_service,
70 PrefService* pref_service, 73 std::unique_ptr<NotificationPresenter> notification_presenter,
71 ProfileOAuth2TokenService* token_service, 74 PrefService* pref_service,
72 NetworkStateHandler* network_state_handler, 75 ProfileOAuth2TokenService* token_service,
73 NetworkConnect* network_connect); 76 NetworkStateHandler* network_state_handler,
77 ManagedNetworkConfigurationHandler* managed_network_configuration_handler,
78 NetworkConnect* network_connect);
74 ~Initializer() override; 79 ~Initializer() override;
75 80
76 // OAuth2TokenService::Observer: 81 // OAuth2TokenService::Observer:
77 void OnRefreshTokensLoaded() override; 82 void OnRefreshTokensLoaded() override;
78 83
79 void FetchBluetoothAdapter(); 84 void FetchBluetoothAdapter();
80 void OnBluetoothAdapterFetched( 85 void OnBluetoothAdapterFetched(
81 scoped_refptr<device::BluetoothAdapter> adapter); 86 scoped_refptr<device::BluetoothAdapter> adapter);
82 void OnBluetoothAdapterAdvertisingIntervalSet( 87 void OnBluetoothAdapterAdvertisingIntervalSet(
83 scoped_refptr<device::BluetoothAdapter> adapter); 88 scoped_refptr<device::BluetoothAdapter> adapter);
84 void OnBluetoothAdapterAdvertisingIntervalError( 89 void OnBluetoothAdapterAdvertisingIntervalError(
85 device::BluetoothAdvertisement::ErrorCode status); 90 device::BluetoothAdvertisement::ErrorCode status);
86 91
87 cryptauth::CryptAuthService* cryptauth_service_; 92 cryptauth::CryptAuthService* cryptauth_service_;
88 std::unique_ptr<NotificationPresenter> notification_presenter_; 93 std::unique_ptr<NotificationPresenter> notification_presenter_;
89 PrefService* pref_service_; 94 PrefService* pref_service_;
90 ProfileOAuth2TokenService* token_service_; 95 ProfileOAuth2TokenService* token_service_;
91 NetworkStateHandler* network_state_handler_; 96 NetworkStateHandler* network_state_handler_;
97 ManagedNetworkConfigurationHandler* managed_network_configuration_handler_;
92 NetworkConnect* network_connect_; 98 NetworkConnect* network_connect_;
93 99
94 // Declare new objects in the order that they will be created during 100 // Declare new objects in the order that they will be created during
95 // initialization to ensure that they are destroyed in the correct order. This 101 // initialization to ensure that they are destroyed in the correct order. This
96 // order will be enforced by InitializerTest.TestCreateAndDestroy. 102 // order will be enforced by InitializerTest.TestCreateAndDestroy.
97 std::unique_ptr<TetherHostFetcher> tether_host_fetcher_; 103 std::unique_ptr<TetherHostFetcher> tether_host_fetcher_;
98 std::unique_ptr<LocalDeviceDataProvider> local_device_data_provider_; 104 std::unique_ptr<LocalDeviceDataProvider> local_device_data_provider_;
99 std::unique_ptr<cryptauth::RemoteBeaconSeedFetcher> 105 std::unique_ptr<cryptauth::RemoteBeaconSeedFetcher>
100 remote_beacon_seed_fetcher_; 106 remote_beacon_seed_fetcher_;
101 std::unique_ptr<BleConnectionManager> ble_connection_manager_; 107 std::unique_ptr<BleConnectionManager> ble_connection_manager_;
102 std::unique_ptr<HostScanDevicePrioritizer> host_scan_device_prioritizer_; 108 std::unique_ptr<HostScanDevicePrioritizer> host_scan_device_prioritizer_;
103 std::unique_ptr<WifiHotspotConnector> wifi_hotspot_connector_; 109 std::unique_ptr<WifiHotspotConnector> wifi_hotspot_connector_;
104 std::unique_ptr<ActiveHost> active_host_; 110 std::unique_ptr<ActiveHost> active_host_;
105 std::unique_ptr<ActiveHostNetworkStateUpdater> 111 std::unique_ptr<ActiveHostNetworkStateUpdater>
106 active_host_network_state_updater_; 112 active_host_network_state_updater_;
107 std::unique_ptr<DeviceIdTetherNetworkGuidMap> 113 std::unique_ptr<DeviceIdTetherNetworkGuidMap>
108 device_id_tether_network_guid_map_; 114 device_id_tether_network_guid_map_;
109 std::unique_ptr<TetherConnector> tether_connector_; 115 std::unique_ptr<TetherConnector> tether_connector_;
116 std::unique_ptr<TetherNetworkDisconnectionHandler>
117 tether_network_disconnection_handler_;
110 std::unique_ptr<HostScanner> host_scanner_; 118 std::unique_ptr<HostScanner> host_scanner_;
111 119
112 base::WeakPtrFactory<Initializer> weak_ptr_factory_; 120 base::WeakPtrFactory<Initializer> weak_ptr_factory_;
113 121
114 DISALLOW_COPY_AND_ASSIGN(Initializer); 122 DISALLOW_COPY_AND_ASSIGN(Initializer);
115 }; 123 };
116 124
117 } // namespace tether 125 } // namespace tether
118 126
119 } // namespace chromeos 127 } // namespace chromeos
120 128
121 #endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_ 129 #endif // CHROMEOS_COMPONENTS_TETHER_INITIALIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698