Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: chromeos/components/tether/tether_disconnector.h

Issue 2975483002: [CrOS Tether] Disconnect cleanly from active Tether networks when the user logs out or the Tether c… (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/components/tether/tether_disconnector.h
diff --git a/chromeos/components/tether/tether_disconnector.h b/chromeos/components/tether/tether_disconnector.h
index b620b92a139c29bf3d5b837c90a249e3c615b74e..0125c7417c02c623e9c6ea2789d0ca7b8bd221a7 100644
--- a/chromeos/components/tether/tether_disconnector.h
+++ b/chromeos/components/tether/tether_disconnector.h
@@ -5,9 +5,7 @@
#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_
#define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_
-#include <memory>
#include <string>
-#include <unordered_map>
#include "base/callback_forward.h"
#include "base/macros.h"
@@ -15,84 +13,31 @@
#include "chromeos/components/tether/disconnect_tethering_operation.h"
#include "chromeos/network/network_handler_callbacks.h"
-namespace base {
-class DictionaryValue;
-}
+class PrefRegistrySimple;
namespace chromeos {
-class NetworkConnectionHandler;
-class NetworkStateHandler;
-
namespace tether {
-class ActiveHost;
-class BleConnectionManager;
-class DeviceIdTetherNetworkGuidMap;
-class NetworkConfigurationRemover;
-class TetherConnector;
-class TetherHostFetcher;
-
-class TetherDisconnector : public DisconnectTetheringOperation::Observer {
+// Disconnects from an active Tether connection.
+class TetherDisconnector {
public:
- TetherDisconnector(
- NetworkConnectionHandler* network_connection_handler,
- NetworkStateHandler* network_state_handler,
- ActiveHost* active_host,
- BleConnectionManager* ble_connection_manager,
- NetworkConfigurationRemover* network_configuration_remover,
- TetherConnector* tether_connector,
- DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map,
- TetherHostFetcher* tether_host_fetcher);
- virtual ~TetherDisconnector();
+ // Registers the prefs used by this class to the given |registry|.
+ static void RegisterPrefs(PrefRegistrySimple* registry);
+ TetherDisconnector() {}
+ virtual ~TetherDisconnector() {}
+
+ // Disconnects from the network with GUID |tether_network_guid|. This GUID
+ // must correspond to an active (i.e., connecting/connected) Tether network.
+ // If disconnection fails, |error_callback| is invoked with a
+ // NetworkConnectionHandler error value.
virtual void DisconnectFromNetwork(
const std::string& tether_network_guid,
const base::Closure& success_callback,
- const network_handler::StringResultCallback& error_callback);
-
- // DisconnectTetheringOperation::Observer:
- void OnOperationFinished(const std::string& device_id, bool success) override;
+ const network_handler::StringResultCallback& error_callback) = 0;
private:
- friend class TetherDisconnectorTest;
-
- void DisconnectActiveWifiConnection(
- const std::string& tether_network_guid,
- const std::string& wifi_network_guid,
- const base::Closure& success_callback,
- const network_handler::StringResultCallback& error_callback);
- void OnSuccessfulWifiDisconnect(
- const std::string& wifi_network_guid,
- const base::Closure& success_callback,
- const network_handler::StringResultCallback& error_callback);
- void OnFailedWifiDisconnect(
- const std::string& wifi_network_guid,
- const base::Closure& success_callback,
- const network_handler::StringResultCallback& error_callback,
- const std::string& error_name,
- std::unique_ptr<base::DictionaryValue> error_data);
- void CleanUpAfterWifiDisconnection(
- bool success,
- const std::string& wifi_network_guid,
- const base::Closure& success_callback,
- const network_handler::StringResultCallback& error_callback);
- void OnTetherHostFetched(
- const std::string& device_id,
- std::unique_ptr<cryptauth::RemoteDevice> tether_host);
-
- NetworkConnectionHandler* network_connection_handler_;
- NetworkStateHandler* network_state_handler_;
- ActiveHost* active_host_;
- BleConnectionManager* ble_connection_manager_;
- NetworkConfigurationRemover* network_configuration_remover_;
- TetherConnector* tether_connector_;
- DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_;
- TetherHostFetcher* tether_host_fetcher_;
-
- std::unique_ptr<DisconnectTetheringOperation> disconnect_tethering_operation_;
- base::WeakPtrFactory<TetherDisconnector> weak_ptr_factory_;
-
DISALLOW_COPY_AND_ASSIGN(TetherDisconnector);
};

Powered by Google App Engine
This is Rietveld 408576698