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.h" | 5 #include "chromeos/network/network_connection_handler.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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
649 error = kErrorConnecting; | 649 error = kErrorConnecting; |
650 } else { | 650 } else { |
651 NET_LOG_ERROR("Connect Failure, Shill error: " + dbus_error_name, | 651 NET_LOG_ERROR("Connect Failure, Shill error: " + dbus_error_name, |
652 service_path); | 652 service_path); |
653 error = kErrorConnectFailed; | 653 error = kErrorConnectFailed; |
654 } | 654 } |
655 InvokeConnectErrorCallback(service_path, error_callback, error); | 655 InvokeConnectErrorCallback(service_path, error_callback, error); |
656 } | 656 } |
657 | 657 |
658 void NetworkConnectionHandler::CheckPendingRequest( | 658 void NetworkConnectionHandler::CheckPendingRequest( |
659 const std::string service_path) { | 659 const std::string& service_path) { |
660 ConnectRequest* request = GetPendingRequest(service_path); | 660 ConnectRequest* request = GetPendingRequest(service_path); |
661 DCHECK(request); | 661 DCHECK(request); |
662 if (request->connect_state == ConnectRequest::CONNECT_REQUESTED) | 662 if (request->connect_state == ConnectRequest::CONNECT_REQUESTED) |
663 return; // Request has not started, ignore update | 663 return; // Request has not started, ignore update |
664 const NetworkState* network = | 664 const NetworkState* network = |
665 network_state_handler_->GetNetworkState(service_path); | 665 network_state_handler_->GetNetworkState(service_path); |
666 if (!network) | 666 if (!network) |
667 return; // NetworkState may not be be updated yet. | 667 return; // NetworkState may not be be updated yet. |
668 | 668 |
669 if (network->IsConnectingState()) { | 669 if (network->IsConnectingState()) { |
(...skipping 30 matching lines...) Expand all Loading... | |
700 } else { | 700 } else { |
701 error_name = kErrorConnectFailed; | 701 error_name = kErrorConnectFailed; |
702 if (network->connection_state() != shill::kStateFailure) { | 702 if (network->connection_state() != shill::kStateFailure) { |
703 NET_LOG_ERROR("Unexpected State: " + network->connection_state(), | 703 NET_LOG_ERROR("Unexpected State: " + network->connection_state(), |
704 service_path); | 704 service_path); |
705 } | 705 } |
706 } | 706 } |
707 | 707 |
708 network_handler::ErrorCallback error_callback = request->error_callback; | 708 network_handler::ErrorCallback error_callback = request->error_callback; |
709 pending_requests_.erase(service_path); | 709 pending_requests_.erase(service_path); |
710 InvokeConnectErrorCallback(service_path, error_callback, error_name); | 710 InvokeConnectErrorCallback(service_path, error_callback, error_name); |
stevenjb
2015/09/21 22:23:39
We *REALLY* need to be careful about this sort of
ki.stfu
2015/09/21 22:55:57
Agreed. Done.
| |
711 } | 711 } |
712 | 712 |
713 void NetworkConnectionHandler::CheckAllPendingRequests() { | 713 void NetworkConnectionHandler::CheckAllPendingRequests() { |
714 for (std::map<std::string, ConnectRequest>::iterator iter = | 714 for (std::map<std::string, ConnectRequest>::iterator iter = |
715 pending_requests_.begin(); iter != pending_requests_.end(); ++iter) { | 715 pending_requests_.begin(); iter != pending_requests_.end(); ++iter) { |
716 CheckPendingRequest(iter->first); | 716 CheckPendingRequest(iter->first); |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
720 // Connect callbacks | 720 // Connect callbacks |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 | 772 |
773 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 773 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
774 const std::string& service_path, | 774 const std::string& service_path, |
775 const base::Closure& success_callback) { | 775 const base::Closure& success_callback) { |
776 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 776 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
777 if (!success_callback.is_null()) | 777 if (!success_callback.is_null()) |
778 success_callback.Run(); | 778 success_callback.Run(); |
779 } | 779 } |
780 | 780 |
781 } // namespace chromeos | 781 } // namespace chromeos |
OLD | NEW |