| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/networking_private/networking_private_chromeos.
h" | 5 #include "extensions/browser/api/networking_private/networking_private_chromeos.
h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 const FailureCallback& failure_callback) { | 529 const FailureCallback& failure_callback) { |
| 530 std::string service_path, error; | 530 std::string service_path, error; |
| 531 if (!GetServicePathFromGuid(guid, &service_path, &error)) { | 531 if (!GetServicePathFromGuid(guid, &service_path, &error)) { |
| 532 failure_callback.Run(error); | 532 failure_callback.Run(error); |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 | 535 |
| 536 const bool check_error_state = false; | 536 const bool check_error_state = false; |
| 537 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( | 537 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( |
| 538 service_path, success_callback, | 538 service_path, success_callback, |
| 539 base::Bind(&NetworkingPrivateChromeOS::ConnectFailureCallback, | 539 base::Bind(&NetworkHandlerFailureCallback, failure_callback), |
| 540 weak_ptr_factory_.GetWeakPtr(), guid, success_callback, | |
| 541 failure_callback), | |
| 542 check_error_state); | 540 check_error_state); |
| 543 } | 541 } |
| 544 | 542 |
| 545 void NetworkingPrivateChromeOS::StartDisconnect( | 543 void NetworkingPrivateChromeOS::StartDisconnect( |
| 546 const std::string& guid, | 544 const std::string& guid, |
| 547 const VoidCallback& success_callback, | 545 const VoidCallback& success_callback, |
| 548 const FailureCallback& failure_callback) { | 546 const FailureCallback& failure_callback) { |
| 549 std::string service_path, error; | 547 std::string service_path, error; |
| 550 if (!GetServicePathFromGuid(guid, &service_path, &error)) { | 548 if (!GetServicePathFromGuid(guid, &service_path, &error)) { |
| 551 failure_callback.Run(error); | 549 failure_callback.Run(error); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 break; | 875 break; |
| 878 } | 876 } |
| 879 case UIProxyConfig::MODE_DIRECT: | 877 case UIProxyConfig::MODE_DIRECT: |
| 880 case UIProxyConfig::MODE_AUTO_DETECT: | 878 case UIProxyConfig::MODE_AUTO_DETECT: |
| 881 break; | 879 break; |
| 882 } | 880 } |
| 883 | 881 |
| 884 VLOG(2) << " NEW PROXY: " << *proxy_settings; | 882 VLOG(2) << " NEW PROXY: " << *proxy_settings; |
| 885 } | 883 } |
| 886 | 884 |
| 887 void NetworkingPrivateChromeOS::ConnectFailureCallback( | |
| 888 const std::string& guid, | |
| 889 const VoidCallback& success_callback, | |
| 890 const FailureCallback& failure_callback, | |
| 891 const std::string& error_name, | |
| 892 std::unique_ptr<base::DictionaryValue> error_data) { | |
| 893 // TODO(stevenjb): Temporary workaround to show the configuration UI. | |
| 894 // Eventually the caller (e.g. Settings) should handle any failures and | |
| 895 // show its own configuration UI. crbug.com/380937. | |
| 896 if (ui_delegate()->HandleConnectFailed(guid, error_name)) { | |
| 897 success_callback.Run(); | |
| 898 return; | |
| 899 } | |
| 900 failure_callback.Run(error_name); | |
| 901 } | |
| 902 | |
| 903 } // namespace extensions | 885 } // namespace extensions |
| OLD | NEW |