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

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

Issue 2857853005: [CrOS Tether] Create TetherDisconnector, which disconnects from active tethering sessions. (Closed)
Patch Set: hansberry@ comments. Created 3 years, 8 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
new file mode 100644
index 0000000000000000000000000000000000000000..b620b92a139c29bf3d5b837c90a249e3c615b74e
--- /dev/null
+++ b/chromeos/components/tether/tether_disconnector.h
@@ -0,0 +1,103 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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"
+#include "base/memory/weak_ptr.h"
+#include "chromeos/components/tether/disconnect_tethering_operation.h"
+#include "chromeos/network/network_handler_callbacks.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+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 {
+ 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();
+
+ 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;
+
+ 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);
+};
+
+} // namespace tether
+
+} // namespace chromeos
+
+#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_
« no previous file with comments | « chromeos/components/tether/tether_connector_unittest.cc ('k') | chromeos/components/tether/tether_disconnector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698