| OLD | NEW |
| 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.h" | 13 #include "chromeos/components/tether/host_scan_device_prioritizer.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/local_device_data_provider.h" | 16 #include "chromeos/components/tether/local_device_data_provider.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/notification_presenter.h" | 19 #include "chromeos/components/tether/notification_presenter.h" |
| 19 #include "chromeos/components/tether/tether_connector.h" | 20 #include "chromeos/components/tether/tether_connector.h" |
| 21 #include "chromeos/components/tether/tether_disconnector.h" |
| 20 #include "chromeos/components/tether/tether_host_fetcher.h" | 22 #include "chromeos/components/tether/tether_host_fetcher.h" |
| 21 #include "chromeos/components/tether/tether_host_response_recorder.h" | 23 #include "chromeos/components/tether/tether_host_response_recorder.h" |
| 22 #include "chromeos/components/tether/tether_network_disconnection_handler.h" | 24 #include "chromeos/components/tether/tether_network_disconnection_handler.h" |
| 23 #include "chromeos/components/tether/wifi_hotspot_connector.h" | 25 #include "chromeos/components/tether/wifi_hotspot_connector.h" |
| 24 #include "chromeos/network/managed_network_configuration_handler.h" | 26 #include "chromeos/network/managed_network_configuration_handler.h" |
| 25 #include "chromeos/network/network_connect.h" | 27 #include "chromeos/network/network_connect.h" |
| 26 #include "chromeos/network/network_connection_handler.h" | 28 #include "chromeos/network/network_connection_handler.h" |
| 27 #include "chromeos/network/network_state_handler.h" | 29 #include "chromeos/network/network_state_handler.h" |
| 28 #include "components/cryptauth/bluetooth_throttler_impl.h" | 30 #include "components/cryptauth/bluetooth_throttler_impl.h" |
| 29 #include "components/cryptauth/cryptauth_service.h" | 31 #include "components/cryptauth/cryptauth_service.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 wifi_hotspot_connector_ = base::MakeUnique<WifiHotspotConnector>( | 187 wifi_hotspot_connector_ = base::MakeUnique<WifiHotspotConnector>( |
| 186 network_state_handler_, network_connect_); | 188 network_state_handler_, network_connect_); |
| 187 active_host_ = | 189 active_host_ = |
| 188 base::MakeUnique<ActiveHost>(tether_host_fetcher_.get(), pref_service_); | 190 base::MakeUnique<ActiveHost>(tether_host_fetcher_.get(), pref_service_); |
| 189 active_host_network_state_updater_ = | 191 active_host_network_state_updater_ = |
| 190 base::MakeUnique<ActiveHostNetworkStateUpdater>(active_host_.get(), | 192 base::MakeUnique<ActiveHostNetworkStateUpdater>(active_host_.get(), |
| 191 network_state_handler_); | 193 network_state_handler_); |
| 192 device_id_tether_network_guid_map_ = | 194 device_id_tether_network_guid_map_ = |
| 193 base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); | 195 base::MakeUnique<DeviceIdTetherNetworkGuidMap>(); |
| 194 tether_connector_ = base::MakeUnique<TetherConnector>( | 196 tether_connector_ = base::MakeUnique<TetherConnector>( |
| 195 network_connection_handler_, network_state_handler_, | 197 network_state_handler_, wifi_hotspot_connector_.get(), active_host_.get(), |
| 196 wifi_hotspot_connector_.get(), active_host_.get(), | |
| 197 tether_host_fetcher_.get(), ble_connection_manager_.get(), | 198 tether_host_fetcher_.get(), ble_connection_manager_.get(), |
| 198 tether_host_response_recorder_.get(), | 199 tether_host_response_recorder_.get(), |
| 199 device_id_tether_network_guid_map_.get()); | 200 device_id_tether_network_guid_map_.get()); |
| 200 network_configuration_remover_ = | 201 network_configuration_remover_ = |
| 201 base::MakeUnique<NetworkConfigurationRemover>( | 202 base::MakeUnique<NetworkConfigurationRemover>( |
| 202 network_state_handler_, managed_network_configuration_handler_); | 203 network_state_handler_, managed_network_configuration_handler_); |
| 204 tether_disconnector_ = base::MakeUnique<TetherDisconnector>( |
| 205 network_connection_handler_, network_state_handler_, active_host_.get(), |
| 206 ble_connection_manager_.get(), network_configuration_remover_.get(), |
| 207 tether_connector_.get(), device_id_tether_network_guid_map_.get(), |
| 208 tether_host_fetcher_.get()); |
| 203 tether_network_disconnection_handler_ = | 209 tether_network_disconnection_handler_ = |
| 204 base::MakeUnique<TetherNetworkDisconnectionHandler>( | 210 base::MakeUnique<TetherNetworkDisconnectionHandler>( |
| 205 active_host_.get(), network_state_handler_, | 211 active_host_.get(), network_state_handler_, |
| 206 network_configuration_remover_.get()); | 212 network_configuration_remover_.get()); |
| 213 network_connection_handler_tether_delegate_ = |
| 214 base::MakeUnique<NetworkConnectionHandlerTetherDelegate>( |
| 215 network_connection_handler_, tether_connector_.get(), |
| 216 tether_disconnector_.get()); |
| 207 host_scan_cache_ = base::MakeUnique<HostScanCache>( | 217 host_scan_cache_ = base::MakeUnique<HostScanCache>( |
| 208 network_state_handler_, active_host_.get(), | 218 network_state_handler_, active_host_.get(), |
| 209 tether_host_response_recorder_.get(), | 219 tether_host_response_recorder_.get(), |
| 210 device_id_tether_network_guid_map_.get()); | 220 device_id_tether_network_guid_map_.get()); |
| 211 host_scanner_ = base::MakeUnique<HostScanner>( | 221 host_scanner_ = base::MakeUnique<HostScanner>( |
| 212 tether_host_fetcher_.get(), ble_connection_manager_.get(), | 222 tether_host_fetcher_.get(), ble_connection_manager_.get(), |
| 213 host_scan_device_prioritizer_.get(), tether_host_response_recorder_.get(), | 223 host_scan_device_prioritizer_.get(), tether_host_response_recorder_.get(), |
| 214 notification_presenter_.get(), device_id_tether_network_guid_map_.get(), | 224 notification_presenter_.get(), device_id_tether_network_guid_map_.get(), |
| 215 host_scan_cache_.get()); | 225 host_scan_cache_.get()); |
| 216 | 226 |
| 217 // TODO(khorimoto): Hook up HostScanScheduler. Currently, we simply start a | 227 // TODO(khorimoto): Hook up HostScanScheduler. Currently, we simply start a |
| 218 // new scan once the user logs in. | 228 // new scan once the user logs in. |
| 219 host_scanner_->StartScan(); | 229 host_scanner_->StartScan(); |
| 220 } | 230 } |
| 221 | 231 |
| 222 void Initializer::OnBluetoothAdapterAdvertisingIntervalError( | 232 void Initializer::OnBluetoothAdapterAdvertisingIntervalError( |
| 223 device::BluetoothAdvertisement::ErrorCode status) { | 233 device::BluetoothAdvertisement::ErrorCode status) { |
| 224 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; " | 234 PA_LOG(ERROR) << "Failed to set Bluetooth advertisement interval; " |
| 225 << "cannot use tether feature. Error code: " << status; | 235 << "cannot use tether feature. Error code: " << status; |
| 226 } | 236 } |
| 227 | 237 |
| 228 } // namespace tether | 238 } // namespace tether |
| 229 | 239 |
| 230 } // namespace chromeos | 240 } // namespace chromeos |
| OLD | NEW |