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

Side by Side Diff: chromeos/components/tether/tether_connector.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 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 #include "chromeos/components/tether/tether_connector.h" 5 #include "chromeos/components/tether/tether_connector.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/device_id_tether_network_guid_map.h" 9 #include "chromeos/components/tether/device_id_tether_network_guid_map.h"
10 #include "chromeos/components/tether/tether_host_fetcher.h" 10 #include "chromeos/components/tether/tether_host_fetcher.h"
11 #include "chromeos/components/tether/wifi_hotspot_connector.h" 11 #include "chromeos/components/tether/wifi_hotspot_connector.h"
12 #include "chromeos/network/network_handler.h" 12 #include "chromeos/network/network_handler.h"
13 #include "chromeos/network/network_state_handler.h" 13 #include "chromeos/network/network_state_handler.h"
14 #include "components/proximity_auth/logging/logging.h" 14 #include "components/proximity_auth/logging/logging.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 namespace tether { 18 namespace tether {
19 19
20 TetherConnector::TetherConnector( 20 TetherConnector::TetherConnector(
21 NetworkConnectionHandler* network_connection_handler, 21 NetworkConnectionHandler* network_connection_handler,
22 NetworkStateHandler* network_state_handler, 22 NetworkStateHandler* network_state_handler,
23 WifiHotspotConnector* wifi_hotspot_connector, 23 WifiHotspotConnector* wifi_hotspot_connector,
24 ActiveHost* active_host, 24 ActiveHost* active_host,
25 TetherHostFetcher* tether_host_fetcher, 25 TetherHostFetcher* tether_host_fetcher,
26 BleConnectionManager* connection_manager, 26 BleConnectionManager* connection_manager,
27 HostScanDevicePrioritizer* host_scan_device_prioritizer, 27 TetherHostResponseRecorder* tether_host_response_recorder,
28 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map) 28 DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map)
29 : network_connection_handler_(network_connection_handler), 29 : network_connection_handler_(network_connection_handler),
30 network_state_handler_(network_state_handler), 30 network_state_handler_(network_state_handler),
31 wifi_hotspot_connector_(wifi_hotspot_connector), 31 wifi_hotspot_connector_(wifi_hotspot_connector),
32 active_host_(active_host), 32 active_host_(active_host),
33 tether_host_fetcher_(tether_host_fetcher), 33 tether_host_fetcher_(tether_host_fetcher),
34 connection_manager_(connection_manager), 34 connection_manager_(connection_manager),
35 host_scan_device_prioritizer_(host_scan_device_prioritizer), 35 tether_host_response_recorder_(tether_host_response_recorder),
36 device_id_tether_network_guid_map_(device_id_tether_network_guid_map), 36 device_id_tether_network_guid_map_(device_id_tether_network_guid_map),
37 weak_ptr_factory_(this) { 37 weak_ptr_factory_(this) {
38 network_connection_handler_->SetTetherDelegate(this); 38 network_connection_handler_->SetTetherDelegate(this);
39 } 39 }
40 40
41 TetherConnector::~TetherConnector() { 41 TetherConnector::~TetherConnector() {
42 network_connection_handler_->SetTetherDelegate(nullptr); 42 network_connection_handler_->SetTetherDelegate(nullptr);
43 if (connect_tethering_operation_) { 43 if (connect_tethering_operation_) {
44 connect_tethering_operation_->RemoveObserver(this); 44 connect_tethering_operation_->RemoveObserver(this);
45 } 45 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 << ". Cannot connect."; 168 << ". Cannot connect.";
169 SetConnectionFailed(); 169 SetConnectionFailed();
170 return; 170 return;
171 } 171 }
172 172
173 DCHECK(device_id == tether_host_to_connect->GetDeviceId()); 173 DCHECK(device_id == tether_host_to_connect->GetDeviceId());
174 174
175 connect_tethering_operation_ = 175 connect_tethering_operation_ =
176 ConnectTetheringOperation::Factory::NewInstance( 176 ConnectTetheringOperation::Factory::NewInstance(
177 *tether_host_to_connect, connection_manager_, 177 *tether_host_to_connect, connection_manager_,
178 host_scan_device_prioritizer_); 178 tether_host_response_recorder_);
179 connect_tethering_operation_->AddObserver(this); 179 connect_tethering_operation_->AddObserver(this);
180 connect_tethering_operation_->Initialize(); 180 connect_tethering_operation_->Initialize();
181 } 181 }
182 182
183 void TetherConnector::SetConnectionFailed() { 183 void TetherConnector::SetConnectionFailed() {
184 DCHECK(!device_id_pending_connection_.empty()); 184 DCHECK(!device_id_pending_connection_.empty());
185 DCHECK(!error_callback_.is_null()); 185 DCHECK(!error_callback_.is_null());
186 186
187 // Save a copy of the callback before resetting it below. 187 // Save a copy of the callback before resetting it below.
188 network_handler::StringResultCallback error_callback = error_callback_; 188 network_handler::StringResultCallback error_callback = error_callback_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 << device_id << "\" to Wi-Fi network with ID \"" 258 << device_id << "\" to Wi-Fi network with ID \""
259 << wifi_network_guid << "\"."; 259 << wifi_network_guid << "\".";
260 } 260 }
261 261
262 SetConnectionSucceeded(device_id, wifi_network_guid); 262 SetConnectionSucceeded(device_id, wifi_network_guid);
263 } 263 }
264 264
265 } // namespace tether 265 } // namespace tether
266 266
267 } // namespace chromeos 267 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/components/tether/tether_connector.h ('k') | chromeos/components/tether/tether_connector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698