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