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

Side by Side Diff: chromeos/components/tether/tether_disconnector_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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_DISCONNECTOR_H_ 5 #ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_
6 #define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ 6 #define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chromeos/components/tether/disconnect_tethering_operation.h" 15 #include "chromeos/components/tether/disconnect_tethering_operation.h"
16 #include "chromeos/components/tether/tether_disconnector.h"
16 #include "chromeos/network/network_handler_callbacks.h" 17 #include "chromeos/network/network_handler_callbacks.h"
17 18
19 class PrefRegistrySimple;
20 class PrefService;
21
18 namespace base { 22 namespace base {
19 class DictionaryValue; 23 class DictionaryValue;
20 } 24 }
21 25
22 namespace chromeos { 26 namespace chromeos {
23 27
24 class NetworkConnectionHandler; 28 class NetworkConnectionHandler;
25 class NetworkStateHandler; 29 class NetworkStateHandler;
26 30
27 namespace tether { 31 namespace tether {
28 32
29 class ActiveHost; 33 class ActiveHost;
30 class BleConnectionManager; 34 class BleConnectionManager;
31 class DeviceIdTetherNetworkGuidMap; 35 class DeviceIdTetherNetworkGuidMap;
32 class NetworkConfigurationRemover; 36 class NetworkConfigurationRemover;
33 class TetherConnector; 37 class TetherConnector;
34 class TetherHostFetcher; 38 class TetherHostFetcher;
35 39
36 class TetherDisconnector : public DisconnectTetheringOperation::Observer { 40 class TetherDisconnectorImpl : public TetherDisconnector,
41 public DisconnectTetheringOperation::Observer {
37 public: 42 public:
38 TetherDisconnector( 43 // Registers the prefs used by this class to the given |registry|.
44 static void RegisterPrefs(PrefRegistrySimple* registry);
Ryan Hansberry 2017/07/11 22:23:56 Why a RegisterPrefs on the interface and impl?
Kyle Horimoto 2017/07/12 01:42:59 Should only have been here - fixed.
45
46 TetherDisconnectorImpl(
39 NetworkConnectionHandler* network_connection_handler, 47 NetworkConnectionHandler* network_connection_handler,
40 NetworkStateHandler* network_state_handler, 48 NetworkStateHandler* network_state_handler,
41 ActiveHost* active_host, 49 ActiveHost* active_host,
42 BleConnectionManager* ble_connection_manager, 50 BleConnectionManager* ble_connection_manager,
43 NetworkConfigurationRemover* network_configuration_remover, 51 NetworkConfigurationRemover* network_configuration_remover,
44 TetherConnector* tether_connector, 52 TetherConnector* tether_connector,
45 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map, 53 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map,
46 TetherHostFetcher* tether_host_fetcher); 54 TetherHostFetcher* tether_host_fetcher,
47 virtual ~TetherDisconnector(); 55 PrefService* pref_service);
56 ~TetherDisconnectorImpl() override;
48 57
49 virtual void DisconnectFromNetwork( 58 void DisconnectFromNetwork(
50 const std::string& tether_network_guid, 59 const std::string& tether_network_guid,
51 const base::Closure& success_callback, 60 const base::Closure& success_callback,
52 const network_handler::StringResultCallback& error_callback); 61 const network_handler::StringResultCallback& error_callback) override;
53 62
54 // DisconnectTetheringOperation::Observer: 63 // DisconnectTetheringOperation::Observer:
55 void OnOperationFinished(const std::string& device_id, bool success) override; 64 void OnOperationFinished(const std::string& device_id, bool success) override;
56 65
57 private: 66 private:
58 friend class TetherDisconnectorTest; 67 friend class TetherDisconnectorImplTest;
59 68
60 void DisconnectActiveWifiConnection( 69 void DisconnectActiveWifiConnection(
61 const std::string& tether_network_guid, 70 const std::string& tether_network_guid,
62 const std::string& wifi_network_guid, 71 const std::string& wifi_network_guid,
63 const base::Closure& success_callback, 72 const base::Closure& success_callback,
64 const network_handler::StringResultCallback& error_callback); 73 const network_handler::StringResultCallback& error_callback);
65 void OnSuccessfulWifiDisconnect( 74 void OnSuccessfulWifiDisconnect(
66 const std::string& wifi_network_guid, 75 const std::string& wifi_network_guid,
67 const base::Closure& success_callback, 76 const base::Closure& success_callback,
68 const network_handler::StringResultCallback& error_callback); 77 const network_handler::StringResultCallback& error_callback);
(...skipping 13 matching lines...) Expand all
82 std::unique_ptr<cryptauth::RemoteDevice> tether_host); 91 std::unique_ptr<cryptauth::RemoteDevice> tether_host);
83 92
84 NetworkConnectionHandler* network_connection_handler_; 93 NetworkConnectionHandler* network_connection_handler_;
85 NetworkStateHandler* network_state_handler_; 94 NetworkStateHandler* network_state_handler_;
86 ActiveHost* active_host_; 95 ActiveHost* active_host_;
87 BleConnectionManager* ble_connection_manager_; 96 BleConnectionManager* ble_connection_manager_;
88 NetworkConfigurationRemover* network_configuration_remover_; 97 NetworkConfigurationRemover* network_configuration_remover_;
89 TetherConnector* tether_connector_; 98 TetherConnector* tether_connector_;
90 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_; 99 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map_;
91 TetherHostFetcher* tether_host_fetcher_; 100 TetherHostFetcher* tether_host_fetcher_;
101 PrefService* pref_service_;
92 102
93 std::unique_ptr<DisconnectTetheringOperation> disconnect_tethering_operation_; 103 std::unique_ptr<DisconnectTetheringOperation> disconnect_tethering_operation_;
94 base::WeakPtrFactory<TetherDisconnector> weak_ptr_factory_; 104 base::WeakPtrFactory<TetherDisconnectorImpl> weak_ptr_factory_;
95 105
96 DISALLOW_COPY_AND_ASSIGN(TetherDisconnector); 106 DISALLOW_COPY_AND_ASSIGN(TetherDisconnectorImpl);
97 }; 107 };
98 108
99 } // namespace tether 109 } // namespace tether
100 110
101 } // namespace chromeos 111 } // namespace chromeos
102 112
103 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ 113 #endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698