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

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

Issue 2844973002: [CrOS Tether] Create TetherHostResponseRecorder, which records ConnectTetheringResponses and Tether… (Closed)
Patch Set: Changed "Connectable" wording to "Connected". Created 3 years, 7 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_device_prioritizer.h" 12 #include "chromeos/components/tether/host_scan_device_prioritizer.h"
13 #include "chromeos/components/tether/host_scan_scheduler.h" 13 #include "chromeos/components/tether/host_scan_scheduler.h"
14 #include "chromeos/components/tether/host_scanner.h" 14 #include "chromeos/components/tether/host_scanner.h"
15 #include "chromeos/components/tether/local_device_data_provider.h" 15 #include "chromeos/components/tether/local_device_data_provider.h"
16 #include "chromeos/components/tether/network_configuration_remover.h" 16 #include "chromeos/components/tether/network_configuration_remover.h"
17 #include "chromeos/components/tether/notification_presenter.h" 17 #include "chromeos/components/tether/notification_presenter.h"
18 #include "chromeos/components/tether/tether_connector.h" 18 #include "chromeos/components/tether/tether_connector.h"
19 #include "chromeos/components/tether/tether_device_state_manager.h" 19 #include "chromeos/components/tether/tether_device_state_manager.h"
20 #include "chromeos/components/tether/tether_host_fetcher.h" 20 #include "chromeos/components/tether/tether_host_fetcher.h"
21 #include "chromeos/components/tether/tether_host_response_recorder.h"
21 #include "chromeos/components/tether/tether_network_disconnection_handler.h" 22 #include "chromeos/components/tether/tether_network_disconnection_handler.h"
22 #include "chromeos/components/tether/wifi_hotspot_connector.h" 23 #include "chromeos/components/tether/wifi_hotspot_connector.h"
23 #include "chromeos/network/managed_network_configuration_handler.h" 24 #include "chromeos/network/managed_network_configuration_handler.h"
24 #include "chromeos/network/network_connect.h" 25 #include "chromeos/network/network_connect.h"
25 #include "chromeos/network/network_connection_handler.h" 26 #include "chromeos/network/network_connection_handler.h"
26 #include "chromeos/network/network_state_handler.h" 27 #include "chromeos/network/network_state_handler.h"
27 #include "components/cryptauth/bluetooth_throttler_impl.h" 28 #include "components/cryptauth/bluetooth_throttler_impl.h"
28 #include "components/cryptauth/cryptauth_service.h" 29 #include "components/cryptauth/cryptauth_service.h"
29 #include "components/cryptauth/remote_beacon_seed_fetcher.h" 30 #include "components/cryptauth/remote_beacon_seed_fetcher.h"
30 #include "components/prefs/pref_service.h" 31 #include "components/prefs/pref_service.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (instance_) { 84 if (instance_) {
84 PA_LOG(INFO) << "Shutting down tether feature."; 85 PA_LOG(INFO) << "Shutting down tether feature.";
85 delete instance_; 86 delete instance_;
86 instance_ = nullptr; 87 instance_ = nullptr;
87 } 88 }
88 } 89 }
89 90
90 // static 91 // static
91 void Initializer::RegisterProfilePrefs(PrefRegistrySimple* registry) { 92 void Initializer::RegisterProfilePrefs(PrefRegistrySimple* registry) {
92 ActiveHost::RegisterPrefs(registry); 93 ActiveHost::RegisterPrefs(registry);
93 HostScanDevicePrioritizer::RegisterPrefs(registry); 94 TetherHostResponseRecorder::RegisterPrefs(registry);
94 } 95 }
95 96
96 Initializer::Initializer( 97 Initializer::Initializer(
97 cryptauth::CryptAuthService* cryptauth_service, 98 cryptauth::CryptAuthService* cryptauth_service,
98 std::unique_ptr<NotificationPresenter> notification_presenter, 99 std::unique_ptr<NotificationPresenter> notification_presenter,
99 PrefService* pref_service, 100 PrefService* pref_service,
100 ProfileOAuth2TokenService* token_service, 101 ProfileOAuth2TokenService* token_service,
101 NetworkStateHandler* network_state_handler, 102 NetworkStateHandler* network_state_handler,
102 ManagedNetworkConfigurationHandler* managed_network_configuration_handler, 103 ManagedNetworkConfigurationHandler* managed_network_configuration_handler,
103 NetworkConnect* network_connect, 104 NetworkConnect* network_connect,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 base::MakeUnique<TetherHostFetcher>(cryptauth_service_); 173 base::MakeUnique<TetherHostFetcher>(cryptauth_service_);
173 local_device_data_provider_ = 174 local_device_data_provider_ =
174 base::MakeUnique<LocalDeviceDataProvider>(cryptauth_service_); 175 base::MakeUnique<LocalDeviceDataProvider>(cryptauth_service_);
175 remote_beacon_seed_fetcher_ = 176 remote_beacon_seed_fetcher_ =
176 base::MakeUnique<cryptauth::RemoteBeaconSeedFetcher>( 177 base::MakeUnique<cryptauth::RemoteBeaconSeedFetcher>(
177 cryptauth_service_->GetCryptAuthDeviceManager()); 178 cryptauth_service_->GetCryptAuthDeviceManager());
178 ble_connection_manager_ = base::MakeUnique<BleConnectionManager>( 179 ble_connection_manager_ = base::MakeUnique<BleConnectionManager>(
179 cryptauth_service_, adapter, local_device_data_provider_.get(), 180 cryptauth_service_, adapter, local_device_data_provider_.get(),
180 remote_beacon_seed_fetcher_.get(), 181 remote_beacon_seed_fetcher_.get(),
181 cryptauth::BluetoothThrottlerImpl::GetInstance()); 182 cryptauth::BluetoothThrottlerImpl::GetInstance());
182 host_scan_device_prioritizer_ = 183 tether_host_response_recorder_ =
183 base::MakeUnique<HostScanDevicePrioritizer>(pref_service_); 184 base::MakeUnique<TetherHostResponseRecorder>(pref_service_);
185 host_scan_device_prioritizer_ = base::MakeUnique<HostScanDevicePrioritizer>(
186 tether_host_response_recorder_.get());
184 wifi_hotspot_connector_ = base::MakeUnique<WifiHotspotConnector>( 187 wifi_hotspot_connector_ = base::MakeUnique<WifiHotspotConnector>(
185 network_state_handler_, network_connect_); 188 network_state_handler_, network_connect_);
186 active_host_ = 189 active_host_ =
187 base::MakeUnique<ActiveHost>(tether_host_fetcher_.get(), pref_service_); 190 base::MakeUnique<ActiveHost>(tether_host_fetcher_.get(), pref_service_);
188 active_host_network_state_updater_ = 191 active_host_network_state_updater_ =
189 base::MakeUnique<ActiveHostNetworkStateUpdater>(active_host_.get(), 192 base::MakeUnique<ActiveHostNetworkStateUpdater>(active_host_.get(),
190 network_state_handler_); 193 network_state_handler_);
191 device_id_tether_network_guid_map_ = 194 device_id_tether_network_guid_map_ =
192 base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); 195 base::MakeUnique<DeviceIdTetherNetworkGuidMap>();
193 tether_connector_ = base::MakeUnique<TetherConnector>( 196 tether_connector_ = base::MakeUnique<TetherConnector>(
194 network_connection_handler_, network_state_handler_, 197 network_connection_handler_, network_state_handler_,
195 wifi_hotspot_connector_.get(), active_host_.get(), 198 wifi_hotspot_connector_.get(), active_host_.get(),
196 tether_host_fetcher_.get(), ble_connection_manager_.get(), 199 tether_host_fetcher_.get(), ble_connection_manager_.get(),
197 host_scan_device_prioritizer_.get(), 200 tether_host_response_recorder_.get(),
198 device_id_tether_network_guid_map_.get()); 201 device_id_tether_network_guid_map_.get());
199 network_configuration_remover_ = 202 network_configuration_remover_ =
200 base::MakeUnique<NetworkConfigurationRemover>( 203 base::MakeUnique<NetworkConfigurationRemover>(
201 network_state_handler_, managed_network_configuration_handler_); 204 network_state_handler_, managed_network_configuration_handler_);
202 tether_network_disconnection_handler_ = 205 tether_network_disconnection_handler_ =
203 base::MakeUnique<TetherNetworkDisconnectionHandler>( 206 base::MakeUnique<TetherNetworkDisconnectionHandler>(
204 active_host_.get(), network_state_handler_, 207 active_host_.get(), network_state_handler_,
205 network_configuration_remover_.get()); 208 network_configuration_remover_.get());
206 host_scanner_ = base::MakeUnique<HostScanner>( 209 host_scanner_ = base::MakeUnique<HostScanner>(
207 tether_host_fetcher_.get(), ble_connection_manager_.get(), 210 tether_host_fetcher_.get(), ble_connection_manager_.get(),
208 host_scan_device_prioritizer_.get(), network_state_handler_, 211 host_scan_device_prioritizer_.get(), tether_host_response_recorder_.get(),
209 notification_presenter_.get(), device_id_tether_network_guid_map_.get()); 212 network_state_handler_, notification_presenter_.get(),
213 device_id_tether_network_guid_map_.get());
210 214
211 // TODO(khorimoto): Hook up HostScanScheduler. Currently, we simply start a 215 // TODO(khorimoto): Hook up HostScanScheduler. Currently, we simply start a
212 // new scan once the user logs in. 216 // new scan once the user logs in.
213 host_scanner_->StartScan(); 217 host_scanner_->StartScan();
214 } 218 }
215 219
216 void Initializer::OnBluetoothAdapterAdvertisingIntervalError( 220 void Initializer::OnBluetoothAdapterAdvertisingIntervalError(
217 device::BluetoothAdvertisement::ErrorCode status) { 221 device::BluetoothAdvertisement::ErrorCode status) {
218 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; " 222 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; "
219 << "cannot use tether feature. Error code: " << status; 223 << "cannot use tether feature. Error code: " << status;
220 } 224 }
221 225
222 } // namespace tether 226 } // namespace tether
223 227
224 } // namespace chromeos 228 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/components/tether/initializer.h ('k') | chromeos/components/tether/mock_host_scan_device_prioritizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698