Chromium Code Reviews| 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 ErrorCallbackForPendingRequest(service_path, kErrorConfigurationRequired); | 415 ErrorCallbackForPendingRequest(service_path, kErrorConfigurationRequired); |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 | 419 |
| 420 std::string guid; | 420 std::string guid; |
| 421 service_properties.GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); | 421 service_properties.GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); |
| 422 std::string profile; | 422 std::string profile; |
| 423 service_properties.GetStringWithoutPathExpansion(shill::kProfileProperty, | 423 service_properties.GetStringWithoutPathExpansion(shill::kProfileProperty, |
| 424 &profile); | 424 &profile); |
| 425 const base::DictionaryValue* user_policy = | 425 ::onc::ONCSource onc_source; |
|
emaxx
2017/04/20 20:10:39
nit: I believe the general guideline is to initial
pmarko
2017/04/24 14:49:56
Done. (also in chromeos/network/client_cert_resolv
| |
| 426 managed_configuration_handler_->FindPolicyByGuidAndProfile(guid, profile); | 426 const base::DictionaryValue* policy = |
| 427 managed_configuration_handler_->FindPolicyByGuidAndProfile(guid, profile, | |
| 428 &onc_source); | |
| 427 | 429 |
| 428 if (IsNetworkProhibitedByPolicy(type, guid, profile)) { | 430 if (IsNetworkProhibitedByPolicy(type, guid, profile)) { |
| 429 ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork); | 431 ErrorCallbackForPendingRequest(service_path, kErrorUnmanagedNetwork); |
| 430 return; | 432 return; |
| 431 } | 433 } |
| 432 | 434 |
| 433 client_cert::ClientCertConfig cert_config_from_policy; | 435 client_cert::ClientCertConfig cert_config_from_policy; |
| 434 if (user_policy) | 436 if (policy) { |
| 435 client_cert::OncToClientCertConfig(*user_policy, &cert_config_from_policy); | 437 client_cert::OncToClientCertConfig(onc_source, *policy, |
| 438 &cert_config_from_policy); | |
| 439 } | |
| 436 | 440 |
| 437 client_cert::ConfigType client_cert_type = client_cert::CONFIG_TYPE_NONE; | 441 client_cert::ConfigType client_cert_type = client_cert::CONFIG_TYPE_NONE; |
| 438 if (type == shill::kTypeVPN) { | 442 if (type == shill::kTypeVPN) { |
| 439 if (vpn_provider_type == shill::kProviderOpenVpn) { | 443 if (vpn_provider_type == shill::kProviderOpenVpn) { |
| 440 client_cert_type = client_cert::CONFIG_TYPE_OPENVPN; | 444 client_cert_type = client_cert::CONFIG_TYPE_OPENVPN; |
| 441 } else { | 445 } else { |
| 442 // L2TP/IPSec only requires a certificate if one is specified in ONC | 446 // L2TP/IPSec only requires a certificate if one is specified in ONC |
| 443 // or one was configured by the UI. Otherwise it is L2TP/IPSec with | 447 // or one was configured by the UI. Otherwise it is L2TP/IPSec with |
| 444 // PSK and doesn't require a certificate. | 448 // PSK and doesn't require a certificate. |
| 445 // | 449 // |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 if (!global_network_config) | 555 if (!global_network_config) |
| 552 return false; | 556 return false; |
| 553 bool policy_prohibites = false; | 557 bool policy_prohibites = false; |
| 554 if (!global_network_config->GetBooleanWithoutPathExpansion( | 558 if (!global_network_config->GetBooleanWithoutPathExpansion( |
| 555 ::onc::global_network_config::kAllowOnlyPolicyNetworksToConnect, | 559 ::onc::global_network_config::kAllowOnlyPolicyNetworksToConnect, |
| 556 &policy_prohibites) || | 560 &policy_prohibites) || |
| 557 !policy_prohibites) { | 561 !policy_prohibites) { |
| 558 return false; | 562 return false; |
| 559 } | 563 } |
| 560 return !managed_configuration_handler_->FindPolicyByGuidAndProfile( | 564 return !managed_configuration_handler_->FindPolicyByGuidAndProfile( |
| 561 guid, profile_path); | 565 guid, profile_path, nullptr); |
| 562 } | 566 } |
| 563 | 567 |
| 564 void NetworkConnectionHandler::QueueConnectRequest( | 568 void NetworkConnectionHandler::QueueConnectRequest( |
| 565 const std::string& service_path) { | 569 const std::string& service_path) { |
| 566 ConnectRequest* request = GetPendingRequest(service_path); | 570 ConnectRequest* request = GetPendingRequest(service_path); |
| 567 if (!request) { | 571 if (!request) { |
| 568 NET_LOG_ERROR("No pending request to queue", service_path); | 572 NET_LOG_ERROR("No pending request to queue", service_path); |
| 569 return; | 573 return; |
| 570 } | 574 } |
| 571 | 575 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 810 | 814 |
| 811 void NetworkConnectionHandler::HandleShillDisconnectSuccess( | 815 void NetworkConnectionHandler::HandleShillDisconnectSuccess( |
| 812 const std::string& service_path, | 816 const std::string& service_path, |
| 813 const base::Closure& success_callback) { | 817 const base::Closure& success_callback) { |
| 814 NET_LOG_EVENT("Disconnect Request Sent", service_path); | 818 NET_LOG_EVENT("Disconnect Request Sent", service_path); |
| 815 if (!success_callback.is_null()) | 819 if (!success_callback.is_null()) |
| 816 success_callback.Run(); | 820 success_callback.Run(); |
| 817 } | 821 } |
| 818 | 822 |
| 819 } // namespace chromeos | 823 } // namespace chromeos |
| OLD | NEW |