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_TETHER_CONNECTOR_H_ | 5 #ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ |
6 #define CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ | 6 #define CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chromeos/components/tether/connect_tethering_operation.h" | 10 #include "chromeos/components/tether/connect_tethering_operation.h" |
11 #include "chromeos/network/network_connection_handler.h" | 11 #include "chromeos/network/network_connection_handler.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 | 14 |
15 class NetworkStateHandler; | 15 class NetworkStateHandler; |
16 | 16 |
17 namespace tether { | 17 namespace tether { |
18 | 18 |
19 class ActiveHost; | 19 class ActiveHost; |
20 class BleConnectionManager; | 20 class BleConnectionManager; |
21 class DeviceIdTetherNetworkGuidMap; | 21 class DeviceIdTetherNetworkGuidMap; |
22 class HostScanDevicePrioritizer; | |
23 class TetherHostFetcher; | 22 class TetherHostFetcher; |
| 23 class TetherHostResponseRecorder; |
24 class WifiHotspotConnector; | 24 class WifiHotspotConnector; |
25 | 25 |
26 // Connects to a tether network. When the user initiates a connection via the | 26 // Connects to a tether network. When the user initiates a connection via the |
27 // UI, TetherConnector receives a callback from NetworkConnectionHandler and | 27 // UI, TetherConnector receives a callback from NetworkConnectionHandler and |
28 // initiates a connection by starting a ConnectTetheringOperation. When a | 28 // initiates a connection by starting a ConnectTetheringOperation. When a |
29 // response has been received from the tether host, TetherConnector connects to | 29 // response has been received from the tether host, TetherConnector connects to |
30 // the associated Wi-Fi network. | 30 // the associated Wi-Fi network. |
31 class TetherConnector : public NetworkConnectionHandler::TetherDelegate, | 31 class TetherConnector : public NetworkConnectionHandler::TetherDelegate, |
32 public ConnectTetheringOperation::Observer { | 32 public ConnectTetheringOperation::Observer { |
33 public: | 33 public: |
34 TetherConnector( | 34 TetherConnector( |
35 NetworkConnectionHandler* network_connection_handler, | 35 NetworkConnectionHandler* network_connection_handler, |
36 NetworkStateHandler* network_state_handler, | 36 NetworkStateHandler* network_state_handler, |
37 WifiHotspotConnector* wifi_hotspot_connector, | 37 WifiHotspotConnector* wifi_hotspot_connector, |
38 ActiveHost* active_host, | 38 ActiveHost* active_host, |
39 TetherHostFetcher* tether_host_fetcher, | 39 TetherHostFetcher* tether_host_fetcher, |
40 BleConnectionManager* connection_manager, | 40 BleConnectionManager* connection_manager, |
41 HostScanDevicePrioritizer* host_scan_device_prioritizer, | 41 TetherHostResponseRecorder* tether_host_response_recorder, |
42 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); | 42 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); |
43 ~TetherConnector() override; | 43 ~TetherConnector() override; |
44 | 44 |
45 // NetworkConnectionHandler::TetherDelegate: | 45 // NetworkConnectionHandler::TetherDelegate: |
46 void ConnectToNetwork( | 46 void ConnectToNetwork( |
47 const std::string& tether_network_guid, | 47 const std::string& tether_network_guid, |
48 const base::Closure& success_callback, | 48 const base::Closure& success_callback, |
49 const network_handler::StringResultCallback& error_callback) override; | 49 const network_handler::StringResultCallback& error_callback) override; |
50 | 50 |
51 // ConnectTetheringOperation::Observer: | 51 // ConnectTetheringOperation::Observer: |
(...skipping 17 matching lines...) Expand all Loading... |
69 std::unique_ptr<cryptauth::RemoteDevice> tether_host_to_connect); | 69 std::unique_ptr<cryptauth::RemoteDevice> tether_host_to_connect); |
70 void OnWifiConnection(const std::string& device_id, | 70 void OnWifiConnection(const std::string& device_id, |
71 const std::string& wifi_network_guid); | 71 const std::string& wifi_network_guid); |
72 | 72 |
73 NetworkConnectionHandler* network_connection_handler_; | 73 NetworkConnectionHandler* network_connection_handler_; |
74 NetworkStateHandler* network_state_handler_; | 74 NetworkStateHandler* network_state_handler_; |
75 WifiHotspotConnector* wifi_hotspot_connector_; | 75 WifiHotspotConnector* wifi_hotspot_connector_; |
76 ActiveHost* active_host_; | 76 ActiveHost* active_host_; |
77 TetherHostFetcher* tether_host_fetcher_; | 77 TetherHostFetcher* tether_host_fetcher_; |
78 BleConnectionManager* connection_manager_; | 78 BleConnectionManager* connection_manager_; |
79 HostScanDevicePrioritizer* host_scan_device_prioritizer_; | 79 TetherHostResponseRecorder* tether_host_response_recorder_; |
80 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; | 80 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; |
81 | 81 |
82 std::string device_id_pending_connection_; | 82 std::string device_id_pending_connection_; |
83 base::Closure success_callback_; | 83 base::Closure success_callback_; |
84 network_handler::StringResultCallback error_callback_; | 84 network_handler::StringResultCallback error_callback_; |
85 std::unique_ptr<ConnectTetheringOperation> connect_tethering_operation_; | 85 std::unique_ptr<ConnectTetheringOperation> connect_tethering_operation_; |
86 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; | 86 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(TetherConnector); | 88 DISALLOW_COPY_AND_ASSIGN(TetherConnector); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace tether | 91 } // namespace tether |
92 | 92 |
93 } // namespace chromeos | 93 } // namespace chromeos |
94 | 94 |
95 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ | 95 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ |
OLD | NEW |