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

Side by Side Diff: chromeos/components/tether/initializer.cc

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 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 #include "chromeos/components/tether/initializer.h" 5 #include "chromeos/components/tether/initializer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chromeos/components/tether/active_host.h" 8 #include "chromeos/components/tether/active_host.h"
9 #include "chromeos/components/tether/active_host_network_state_updater.h" 9 #include "chromeos/components/tether/active_host_network_state_updater.h"
10 #include "chromeos/components/tether/ble_connection_manager.h" 10 #include "chromeos/components/tether/ble_connection_manager.h"
11 #include "chromeos/components/tether/device_id_tether_network_guid_map.h" 11 #include "chromeos/components/tether/device_id_tether_network_guid_map.h"
12 #include "chromeos/components/tether/host_scan_cache.h" 12 #include "chromeos/components/tether/host_scan_cache.h"
13 #include "chromeos/components/tether/host_scan_device_prioritizer_impl.h" 13 #include "chromeos/components/tether/host_scan_device_prioritizer_impl.h"
14 #include "chromeos/components/tether/host_scan_scheduler.h" 14 #include "chromeos/components/tether/host_scan_scheduler.h"
15 #include "chromeos/components/tether/host_scanner.h" 15 #include "chromeos/components/tether/host_scanner.h"
16 #include "chromeos/components/tether/keep_alive_scheduler.h" 16 #include "chromeos/components/tether/keep_alive_scheduler.h"
17 #include "chromeos/components/tether/network_configuration_remover.h" 17 #include "chromeos/components/tether/network_configuration_remover.h"
18 #include "chromeos/components/tether/network_connection_handler_tether_delegate. h" 18 #include "chromeos/components/tether/network_connection_handler_tether_delegate. h"
19 #include "chromeos/components/tether/notification_presenter.h" 19 #include "chromeos/components/tether/notification_presenter.h"
20 #include "chromeos/components/tether/tether_connector.h" 20 #include "chromeos/components/tether/tether_connector.h"
21 #include "chromeos/components/tether/tether_disconnector.h" 21 #include "chromeos/components/tether/tether_disconnector.h"
22 #include "chromeos/components/tether/tether_disconnector_impl.h"
22 #include "chromeos/components/tether/tether_host_fetcher.h" 23 #include "chromeos/components/tether/tether_host_fetcher.h"
23 #include "chromeos/components/tether/tether_host_response_recorder.h" 24 #include "chromeos/components/tether/tether_host_response_recorder.h"
24 #include "chromeos/components/tether/tether_network_disconnection_handler.h" 25 #include "chromeos/components/tether/tether_network_disconnection_handler.h"
25 #include "chromeos/components/tether/wifi_hotspot_connector.h" 26 #include "chromeos/components/tether/wifi_hotspot_connector.h"
26 #include "chromeos/network/managed_network_configuration_handler.h" 27 #include "chromeos/network/managed_network_configuration_handler.h"
27 #include "chromeos/network/network_connect.h" 28 #include "chromeos/network/network_connect.h"
28 #include "chromeos/network/network_connection_handler.h" 29 #include "chromeos/network/network_connection_handler.h"
29 #include "chromeos/network/network_state_handler.h" 30 #include "chromeos/network/network_state_handler.h"
30 #include "components/cryptauth/bluetooth_throttler_impl.h" 31 #include "components/cryptauth/bluetooth_throttler_impl.h"
31 #include "components/cryptauth/cryptauth_service.h" 32 #include "components/cryptauth/cryptauth_service.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 PA_LOG(INFO) << "Shutting down Tether feature."; 88 PA_LOG(INFO) << "Shutting down Tether feature.";
88 delete instance_; 89 delete instance_;
89 instance_ = nullptr; 90 instance_ = nullptr;
90 } 91 }
91 } 92 }
92 93
93 // static 94 // static
94 void Initializer::RegisterProfilePrefs(PrefRegistrySimple* registry) { 95 void Initializer::RegisterProfilePrefs(PrefRegistrySimple* registry) {
95 ActiveHost::RegisterPrefs(registry); 96 ActiveHost::RegisterPrefs(registry);
96 TetherHostResponseRecorder::RegisterPrefs(registry); 97 TetherHostResponseRecorder::RegisterPrefs(registry);
98 TetherDisconnector::RegisterPrefs(registry);
97 } 99 }
98 100
99 Initializer::Initializer( 101 Initializer::Initializer(
100 cryptauth::CryptAuthService* cryptauth_service, 102 cryptauth::CryptAuthService* cryptauth_service,
101 std::unique_ptr<NotificationPresenter> notification_presenter, 103 std::unique_ptr<NotificationPresenter> notification_presenter,
102 PrefService* pref_service, 104 PrefService* pref_service,
103 ProfileOAuth2TokenService* token_service, 105 ProfileOAuth2TokenService* token_service,
104 NetworkStateHandler* network_state_handler, 106 NetworkStateHandler* network_state_handler,
105 ManagedNetworkConfigurationHandler* managed_network_configuration_handler, 107 ManagedNetworkConfigurationHandler* managed_network_configuration_handler,
106 NetworkConnect* network_connect, 108 NetworkConnect* network_connect,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 network_state_handler_, host_scanner_.get()); 217 network_state_handler_, host_scanner_.get());
216 tether_connector_ = base::MakeUnique<TetherConnector>( 218 tether_connector_ = base::MakeUnique<TetherConnector>(
217 network_state_handler_, wifi_hotspot_connector_.get(), active_host_.get(), 219 network_state_handler_, wifi_hotspot_connector_.get(), active_host_.get(),
218 tether_host_fetcher_.get(), ble_connection_manager_.get(), 220 tether_host_fetcher_.get(), ble_connection_manager_.get(),
219 tether_host_response_recorder_.get(), 221 tether_host_response_recorder_.get(),
220 device_id_tether_network_guid_map_.get(), host_scan_cache_.get(), 222 device_id_tether_network_guid_map_.get(), host_scan_cache_.get(),
221 notification_presenter_.get()); 223 notification_presenter_.get());
222 network_configuration_remover_ = 224 network_configuration_remover_ =
223 base::MakeUnique<NetworkConfigurationRemover>( 225 base::MakeUnique<NetworkConfigurationRemover>(
224 network_state_handler_, managed_network_configuration_handler_); 226 network_state_handler_, managed_network_configuration_handler_);
225 tether_disconnector_ = base::MakeUnique<TetherDisconnector>( 227 tether_disconnector_ = base::MakeUnique<TetherDisconnectorImpl>(
226 network_connection_handler_, network_state_handler_, active_host_.get(), 228 network_connection_handler_, network_state_handler_, active_host_.get(),
227 ble_connection_manager_.get(), network_configuration_remover_.get(), 229 ble_connection_manager_.get(), network_configuration_remover_.get(),
228 tether_connector_.get(), device_id_tether_network_guid_map_.get(), 230 tether_connector_.get(), device_id_tether_network_guid_map_.get(),
229 tether_host_fetcher_.get()); 231 tether_host_fetcher_.get(), pref_service_);
230 tether_network_disconnection_handler_ = 232 tether_network_disconnection_handler_ =
231 base::MakeUnique<TetherNetworkDisconnectionHandler>( 233 base::MakeUnique<TetherNetworkDisconnectionHandler>(
232 active_host_.get(), network_state_handler_, 234 active_host_.get(), network_state_handler_,
233 network_configuration_remover_.get()); 235 network_configuration_remover_.get());
234 network_connection_handler_tether_delegate_ = 236 network_connection_handler_tether_delegate_ =
235 base::MakeUnique<NetworkConnectionHandlerTetherDelegate>( 237 base::MakeUnique<NetworkConnectionHandlerTetherDelegate>(
236 network_connection_handler_, tether_connector_.get(), 238 network_connection_handler_, tether_connector_.get(),
237 tether_disconnector_.get()); 239 tether_disconnector_.get());
238 240
239 // Because Initializer is created on each user log in, it's appropriate to 241 // Because Initializer is created on each user log in, it's appropriate to
240 // call this method now. 242 // call this method now.
241 host_scan_scheduler_->UserLoggedIn(); 243 host_scan_scheduler_->UserLoggedIn();
242 } 244 }
243 245
244 void Initializer::OnBluetoothAdapterAdvertisingIntervalError( 246 void Initializer::OnBluetoothAdapterAdvertisingIntervalError(
245 device::BluetoothAdvertisement::ErrorCode status) { 247 device::BluetoothAdvertisement::ErrorCode status) {
246 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; " 248 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; "
247 << "cannot use tether feature. Error code: " << status; 249 << "cannot use tether feature. Error code: " << status;
248 } 250 }
249 251
250 } // namespace tether 252 } // namespace tether
251 253
252 } // namespace chromeos 254 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698