| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 NetworkConnect and initiates a | 27 // UI, TetherConnector receives a callback from NetworkConnect and initiates a |
| 28 // connection by starting a ConnectTetheringOperation. When a response has been | 28 // connection by starting a ConnectTetheringOperation. When a response has been |
| 29 // received from the tether host, TetherConnector connects to the associated | 29 // received from the tether host, TetherConnector connects to the associated |
| 30 // Wi-Fi network. | 30 // Wi-Fi network. |
| 31 class TetherConnector : public NetworkConnect::TetherDelegate, | 31 class TetherConnector : public NetworkConnect::TetherDelegate, |
| 32 public ConnectTetheringOperation::Observer { | 32 public ConnectTetheringOperation::Observer { |
| 33 public: | 33 public: |
| 34 TetherConnector( | 34 TetherConnector( |
| 35 NetworkConnect* network_connect, |
| 36 NetworkStateHandler* network_state_handler, |
| 35 WifiHotspotConnector* wifi_hotspot_connector, | 37 WifiHotspotConnector* wifi_hotspot_connector, |
| 36 ActiveHost* active_host, | 38 ActiveHost* active_host, |
| 37 TetherHostFetcher* tether_host_fetcher, | 39 TetherHostFetcher* tether_host_fetcher, |
| 38 BleConnectionManager* connection_manager, | 40 BleConnectionManager* connection_manager, |
| 39 HostScanDevicePrioritizer* host_scan_device_prioritizer, | 41 HostScanDevicePrioritizer* host_scan_device_prioritizer, |
| 40 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); | 42 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); |
| 41 ~TetherConnector() override; | 43 ~TetherConnector() override; |
| 42 | 44 |
| 43 // NetworkConnect::TetherDelegate: | 45 // NetworkConnect::TetherDelegate: |
| 44 void ConnectToNetwork(const std::string& guid) override; | 46 void ConnectToNetwork(const std::string& guid) override; |
| 45 | 47 |
| 46 // ConnectTetheringOperation::Observer: | 48 // ConnectTetheringOperation::Observer: |
| 47 void OnSuccessfulConnectTetheringResponse( | 49 void OnSuccessfulConnectTetheringResponse( |
| 48 const cryptauth::RemoteDevice& remote_device, | 50 const cryptauth::RemoteDevice& remote_device, |
| 49 const std::string& ssid, | 51 const std::string& ssid, |
| 50 const std::string& password) override; | 52 const std::string& password) override; |
| 51 void OnConnectTetheringFailure( | 53 void OnConnectTetheringFailure( |
| 52 const cryptauth::RemoteDevice& remote_device, | 54 const cryptauth::RemoteDevice& remote_device, |
| 53 ConnectTetheringResponse_ResponseCode error_code) override; | 55 ConnectTetheringResponse_ResponseCode error_code) override; |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 friend class TetherConnectorTest; | 58 friend class TetherConnectorTest; |
| 57 | 59 |
| 58 TetherConnector( | |
| 59 NetworkConnect* network_connect, | |
| 60 NetworkStateHandler* network_state_handler, | |
| 61 WifiHotspotConnector* wifi_hotspot_connector, | |
| 62 ActiveHost* active_host, | |
| 63 TetherHostFetcher* tether_host_fetcher, | |
| 64 BleConnectionManager* connection_manager, | |
| 65 HostScanDevicePrioritizer* host_scan_device_prioritizer, | |
| 66 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); | |
| 67 | |
| 68 void SetDisconnected(); | 60 void SetDisconnected(); |
| 69 void SetConnected(const std::string& device_id, | 61 void SetConnected(const std::string& device_id, |
| 70 const std::string& wifi_network_guid); | 62 const std::string& wifi_network_guid); |
| 71 | 63 |
| 72 void OnTetherHostToConnectFetched( | 64 void OnTetherHostToConnectFetched( |
| 73 const std::string& device_id, | 65 const std::string& device_id, |
| 74 std::unique_ptr<cryptauth::RemoteDevice> tether_host_to_connect); | 66 std::unique_ptr<cryptauth::RemoteDevice> tether_host_to_connect); |
| 75 void OnWifiConnection(const std::string& device_id, | 67 void OnWifiConnection(const std::string& device_id, |
| 76 const std::string& wifi_network_guid); | 68 const std::string& wifi_network_guid); |
| 77 | 69 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; | 81 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; |
| 90 | 82 |
| 91 DISALLOW_COPY_AND_ASSIGN(TetherConnector); | 83 DISALLOW_COPY_AND_ASSIGN(TetherConnector); |
| 92 }; | 84 }; |
| 93 | 85 |
| 94 } // namespace tether | 86 } // namespace tether |
| 95 | 87 |
| 96 } // namespace chromeos | 88 } // namespace chromeos |
| 97 | 89 |
| 98 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ | 90 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ |
| OLD | NEW |