OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ |
| 6 #define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 #include <unordered_map> |
| 11 |
| 12 #include "base/callback_forward.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chromeos/components/tether/disconnect_tethering_operation.h" |
| 16 #include "chromeos/network/network_handler_callbacks.h" |
| 17 |
| 18 namespace base { |
| 19 class DictionaryValue; |
| 20 } |
| 21 |
| 22 namespace chromeos { |
| 23 |
| 24 class NetworkConnectionHandler; |
| 25 class NetworkStateHandler; |
| 26 |
| 27 namespace tether { |
| 28 |
| 29 class ActiveHost; |
| 30 class BleConnectionManager; |
| 31 class DeviceIdTetherNetworkGuidMap; |
| 32 class NetworkConfigurationRemover; |
| 33 class TetherConnector; |
| 34 class TetherHostFetcher; |
| 35 |
| 36 class TetherDisconnector : public DisconnectTetheringOperation::Observer { |
| 37 public: |
| 38 TetherDisconnector( |
| 39 NetworkConnectionHandler* network_connection_handler, |
| 40 NetworkStateHandler* network_state_handler, |
| 41 ActiveHost* active_host, |
| 42 BleConnectionManager* ble_connection_manager, |
| 43 NetworkConfigurationRemover* network_configuration_remover, |
| 44 TetherConnector* tether_connector, |
| 45 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, |
| 46 TetherHostFetcher* tether_host_fetcher); |
| 47 virtual ~TetherDisconnector(); |
| 48 |
| 49 virtual void DisconnectFromNetwork( |
| 50 const std::string& tether_network_guid, |
| 51 const base::Closure& success_callback, |
| 52 const network_handler::StringResultCallback& error_callback); |
| 53 |
| 54 // DisconnectTetheringOperation::Observer: |
| 55 void OnOperationFinished(const std::string& device_id, bool success) override; |
| 56 |
| 57 private: |
| 58 friend class TetherDisconnectorTest; |
| 59 |
| 60 void DisconnectActiveWifiConnection( |
| 61 const std::string& tether_network_guid, |
| 62 const std::string& wifi_network_guid, |
| 63 const base::Closure& success_callback, |
| 64 const network_handler::StringResultCallback& error_callback); |
| 65 void OnSuccessfulWifiDisconnect( |
| 66 const std::string& wifi_network_guid, |
| 67 const base::Closure& success_callback, |
| 68 const network_handler::StringResultCallback& error_callback); |
| 69 void OnFailedWifiDisconnect( |
| 70 const std::string& wifi_network_guid, |
| 71 const base::Closure& success_callback, |
| 72 const network_handler::StringResultCallback& error_callback, |
| 73 const std::string& error_name, |
| 74 std::unique_ptr<base::DictionaryValue> error_data); |
| 75 void CleanUpAfterWifiDisconnection( |
| 76 bool success, |
| 77 const std::string& wifi_network_guid, |
| 78 const base::Closure& success_callback, |
| 79 const network_handler::StringResultCallback& error_callback); |
| 80 void OnTetherHostFetched( |
| 81 const std::string& device_id, |
| 82 std::unique_ptr<cryptauth::RemoteDevice> tether_host); |
| 83 |
| 84 NetworkConnectionHandler* network_connection_handler_; |
| 85 NetworkStateHandler* network_state_handler_; |
| 86 ActiveHost* active_host_; |
| 87 BleConnectionManager* ble_connection_manager_; |
| 88 NetworkConfigurationRemover* network_configuration_remover_; |
| 89 TetherConnector* tether_connector_; |
| 90 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; |
| 91 TetherHostFetcher* tether_host_fetcher_; |
| 92 |
| 93 std::unique_ptr<DisconnectTetheringOperation> disconnect_tethering_operation_; |
| 94 base::WeakPtrFactory<TetherDisconnector> weak_ptr_factory_; |
| 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(TetherDisconnector); |
| 97 }; |
| 98 |
| 99 } // namespace tether |
| 100 |
| 101 } // namespace chromeos |
| 102 |
| 103 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ |
OLD | NEW |