OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/network/network_connection_handler_impl.h" | 5 #include "chromeos/network/network_connection_handler_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 | 235 |
236 if (NetworkTypePattern::Tether().MatchesType(network->type())) { | 236 if (NetworkTypePattern::Tether().MatchesType(network->type())) { |
237 if (tether_delegate_) { | 237 if (tether_delegate_) { |
238 const std::string& tether_network_guid = network->guid(); | 238 const std::string& tether_network_guid = network->guid(); |
239 DCHECK(!tether_network_guid.empty()); | 239 DCHECK(!tether_network_guid.empty()); |
240 InitiateTetherNetworkConnection(tether_network_guid, success_callback, | 240 InitiateTetherNetworkConnection(tether_network_guid, success_callback, |
241 error_callback); | 241 error_callback); |
242 } else { | 242 } else { |
243 InvokeConnectErrorCallback(service_path, error_callback, | 243 InvokeConnectErrorCallback(service_path, error_callback, |
244 kErrorTetherConnectionAttemptWithNoDelegate); | 244 kErrorTetherAttemptWithNoDelegate); |
245 } | 245 } |
246 return; | 246 return; |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 // If the network does not have a profile path, specify the correct default | 250 // If the network does not have a profile path, specify the correct default |
251 // profile here and set it once connected. Otherwise leave it empty to | 251 // profile here and set it once connected. Otherwise leave it empty to |
252 // indicate that it does not need to be set. | 252 // indicate that it does not need to be set. |
253 std::string profile_path; | 253 std::string profile_path; |
254 if (!network || network->profile_path().empty()) | 254 if (!network || network->profile_path().empty()) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 network_handler::RunErrorCallback(error_callback, service_path, | 298 network_handler::RunErrorCallback(error_callback, service_path, |
299 kErrorNotFound, ""); | 299 kErrorNotFound, ""); |
300 return; | 300 return; |
301 } | 301 } |
302 if (!network->IsConnectedState() && !network->IsConnectingState()) { | 302 if (!network->IsConnectedState() && !network->IsConnectingState()) { |
303 NET_LOG_ERROR("Disconnect Error: Not Connected", service_path); | 303 NET_LOG_ERROR("Disconnect Error: Not Connected", service_path); |
304 network_handler::RunErrorCallback(error_callback, service_path, | 304 network_handler::RunErrorCallback(error_callback, service_path, |
305 kErrorNotConnected, ""); | 305 kErrorNotConnected, ""); |
306 return; | 306 return; |
307 } | 307 } |
| 308 if (NetworkTypePattern::Tether().MatchesType(network->type())) { |
| 309 if (tether_delegate_) { |
| 310 const std::string& tether_network_guid = network->guid(); |
| 311 DCHECK(!tether_network_guid.empty()); |
| 312 InitiateTetherNetworkDisconnection(tether_network_guid, success_callback, |
| 313 error_callback); |
| 314 } else { |
| 315 InvokeConnectErrorCallback(service_path, error_callback, |
| 316 kErrorTetherAttemptWithNoDelegate); |
| 317 } |
| 318 return; |
| 319 } |
308 pending_requests_.erase(service_path); | 320 pending_requests_.erase(service_path); |
309 CallShillDisconnect(service_path, success_callback, error_callback); | 321 CallShillDisconnect(service_path, success_callback, error_callback); |
310 } | 322 } |
311 | 323 |
312 bool NetworkConnectionHandlerImpl::HasConnectingNetwork( | 324 bool NetworkConnectionHandlerImpl::HasConnectingNetwork( |
313 const std::string& service_path) { | 325 const std::string& service_path) { |
314 return pending_requests_.count(service_path) != 0; | 326 return pending_requests_.count(service_path) != 0; |
315 } | 327 } |
316 | 328 |
317 bool NetworkConnectionHandlerImpl::HasPendingConnectRequest() { | 329 bool NetworkConnectionHandlerImpl::HasPendingConnectRequest() { |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 | 778 |
767 void NetworkConnectionHandlerImpl::HandleShillDisconnectSuccess( | 779 void NetworkConnectionHandlerImpl::HandleShillDisconnectSuccess( |
768 const std::string& service_path, | 780 const std::string& service_path, |
769 const base::Closure& success_callback) { | 781 const base::Closure& success_callback) { |
770 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 782 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
771 if (!success_callback.is_null()) | 783 if (!success_callback.is_null()) |
772 success_callback.Run(); | 784 success_callback.Run(); |
773 } | 785 } |
774 | 786 |
775 } // namespace chromeos | 787 } // namespace chromeos |
OLD | NEW |