| 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 HostScanCache; |
| 23 class NotificationPresenter; |
| 22 class TetherHostFetcher; | 24 class TetherHostFetcher; |
| 23 class TetherHostResponseRecorder; | 25 class TetherHostResponseRecorder; |
| 24 class WifiHotspotConnector; | 26 class WifiHotspotConnector; |
| 25 | 27 |
| 26 // Connects to a tether network. When the user initiates a connection via the | 28 // Connects to a tether network. When the user initiates a connection via the |
| 27 // UI, TetherConnector receives a callback from NetworkConnectionHandler and | 29 // UI, TetherConnector receives a callback from NetworkConnectionHandler and |
| 28 // initiates a connection by starting a ConnectTetheringOperation. When a | 30 // initiates a connection by starting a ConnectTetheringOperation. When a |
| 29 // response has been received from the tether host, TetherConnector connects to | 31 // response has been received from the tether host, TetherConnector connects to |
| 30 // the associated Wi-Fi network. | 32 // the associated Wi-Fi network. |
| 31 class TetherConnector : public ConnectTetheringOperation::Observer { | 33 class TetherConnector : public ConnectTetheringOperation::Observer { |
| 32 public: | 34 public: |
| 33 TetherConnector( | 35 TetherConnector( |
| 34 NetworkStateHandler* network_state_handler, | 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 TetherHostResponseRecorder* tether_host_response_recorder, | 41 TetherHostResponseRecorder* tether_host_response_recorder, |
| 40 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map); | 42 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, |
| 43 HostScanCache* host_scan_cache, |
| 44 NotificationPresenter* notification_presenter); |
| 41 virtual ~TetherConnector(); | 45 virtual ~TetherConnector(); |
| 42 | 46 |
| 43 virtual void ConnectToNetwork( | 47 virtual void ConnectToNetwork( |
| 44 const std::string& tether_network_guid, | 48 const std::string& tether_network_guid, |
| 45 const base::Closure& success_callback, | 49 const base::Closure& success_callback, |
| 46 const network_handler::StringResultCallback& error_callback); | 50 const network_handler::StringResultCallback& error_callback); |
| 47 | 51 |
| 48 // Returns whether the connection attempt was successfully canceled. | 52 // Returns whether the connection attempt was successfully canceled. |
| 49 virtual bool CancelConnectionAttempt(const std::string& tether_network_guid); | 53 virtual bool CancelConnectionAttempt(const std::string& tether_network_guid); |
| 50 | 54 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 71 const std::string& wifi_network_guid); | 75 const std::string& wifi_network_guid); |
| 72 | 76 |
| 73 NetworkConnectionHandler* network_connection_handler_; | 77 NetworkConnectionHandler* network_connection_handler_; |
| 74 NetworkStateHandler* network_state_handler_; | 78 NetworkStateHandler* network_state_handler_; |
| 75 WifiHotspotConnector* wifi_hotspot_connector_; | 79 WifiHotspotConnector* wifi_hotspot_connector_; |
| 76 ActiveHost* active_host_; | 80 ActiveHost* active_host_; |
| 77 TetherHostFetcher* tether_host_fetcher_; | 81 TetherHostFetcher* tether_host_fetcher_; |
| 78 BleConnectionManager* connection_manager_; | 82 BleConnectionManager* connection_manager_; |
| 79 TetherHostResponseRecorder* tether_host_response_recorder_; | 83 TetherHostResponseRecorder* tether_host_response_recorder_; |
| 80 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; | 84 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; |
| 85 HostScanCache* host_scan_cache_; |
| 86 NotificationPresenter* notification_presenter_; |
| 81 | 87 |
| 82 std::string device_id_pending_connection_; | 88 std::string device_id_pending_connection_; |
| 83 base::Closure success_callback_; | 89 base::Closure success_callback_; |
| 84 network_handler::StringResultCallback error_callback_; | 90 network_handler::StringResultCallback error_callback_; |
| 85 std::unique_ptr<ConnectTetheringOperation> connect_tethering_operation_; | 91 std::unique_ptr<ConnectTetheringOperation> connect_tethering_operation_; |
| 86 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; | 92 base::WeakPtrFactory<TetherConnector> weak_ptr_factory_; |
| 87 | 93 |
| 88 DISALLOW_COPY_AND_ASSIGN(TetherConnector); | 94 DISALLOW_COPY_AND_ASSIGN(TetherConnector); |
| 89 }; | 95 }; |
| 90 | 96 |
| 91 } // namespace tether | 97 } // namespace tether |
| 92 | 98 |
| 93 } // namespace chromeos | 99 } // namespace chromeos |
| 94 | 100 |
| 95 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ | 101 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ |
| OLD | NEW |