| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/options/vpn_config_view.h" | 5 #include "chrome/browser/chromeos/options/vpn_config_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 17 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 15 #include "chrome/browser/chromeos/net/shill_error.h" | 18 #include "chrome/browser/chromeos/net/shill_error.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | 20 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
| 18 #include "chrome/common/net/x509_certificate_model.h" | 21 #include "chrome/common/net/x509_certificate_model.h" |
| 19 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 20 #include "chromeos/login/login_state.h" | 23 #include "chromeos/login/login_state.h" |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 } | 861 } |
| 859 if (!user_passphrase.empty()) { | 862 if (!user_passphrase.empty()) { |
| 860 properties->SetStringWithoutPathExpansion( | 863 properties->SetStringWithoutPathExpansion( |
| 861 shill::kL2tpIpsecPasswordProperty, user_passphrase); | 864 shill::kL2tpIpsecPasswordProperty, user_passphrase); |
| 862 } | 865 } |
| 863 break; | 866 break; |
| 864 } | 867 } |
| 865 case PROVIDER_TYPE_INDEX_L2TP_IPSEC_USER_CERT: { | 868 case PROVIDER_TYPE_INDEX_L2TP_IPSEC_USER_CERT: { |
| 866 if (server_ca_cert_combobox_) { | 869 if (server_ca_cert_combobox_) { |
| 867 std::string ca_cert_pem = GetServerCACertPEM(); | 870 std::string ca_cert_pem = GetServerCACertPEM(); |
| 868 base::ListValue* pem_list = new base::ListValue; | 871 auto pem_list = base::MakeUnique<base::ListValue>(); |
| 869 if (!ca_cert_pem.empty()) | 872 if (!ca_cert_pem.empty()) |
| 870 pem_list->AppendString(ca_cert_pem); | 873 pem_list->AppendString(ca_cert_pem); |
| 871 properties->SetWithoutPathExpansion(shill::kL2tpIpsecCaCertPemProperty, | 874 properties->SetWithoutPathExpansion(shill::kL2tpIpsecCaCertPemProperty, |
| 872 pem_list); | 875 std::move(pem_list)); |
| 873 } | 876 } |
| 874 SetUserCertProperties(client_cert::CONFIG_TYPE_IPSEC, properties); | 877 SetUserCertProperties(client_cert::CONFIG_TYPE_IPSEC, properties); |
| 875 if (!group_name.empty()) { | 878 if (!group_name.empty()) { |
| 876 properties->SetStringWithoutPathExpansion( | 879 properties->SetStringWithoutPathExpansion( |
| 877 shill::kL2tpIpsecTunnelGroupProperty, GetGroupName()); | 880 shill::kL2tpIpsecTunnelGroupProperty, GetGroupName()); |
| 878 } | 881 } |
| 879 if (!user_name.empty()) { | 882 if (!user_name.empty()) { |
| 880 properties->SetStringWithoutPathExpansion( | 883 properties->SetStringWithoutPathExpansion( |
| 881 shill::kL2tpIpsecUserProperty, user_name); | 884 shill::kL2tpIpsecUserProperty, user_name); |
| 882 } | 885 } |
| 883 if (!user_passphrase.empty()) { | 886 if (!user_passphrase.empty()) { |
| 884 properties->SetStringWithoutPathExpansion( | 887 properties->SetStringWithoutPathExpansion( |
| 885 shill::kL2tpIpsecPasswordProperty, user_passphrase); | 888 shill::kL2tpIpsecPasswordProperty, user_passphrase); |
| 886 } | 889 } |
| 887 break; | 890 break; |
| 888 } | 891 } |
| 889 case PROVIDER_TYPE_INDEX_OPEN_VPN: { | 892 case PROVIDER_TYPE_INDEX_OPEN_VPN: { |
| 890 if (server_ca_cert_combobox_) { | 893 if (server_ca_cert_combobox_) { |
| 891 std::string ca_cert_pem = GetServerCACertPEM(); | 894 std::string ca_cert_pem = GetServerCACertPEM(); |
| 892 base::ListValue* pem_list = new base::ListValue; | 895 auto pem_list = base::MakeUnique<base::ListValue>(); |
| 893 if (!ca_cert_pem.empty()) | 896 if (!ca_cert_pem.empty()) |
| 894 pem_list->AppendString(ca_cert_pem); | 897 pem_list->AppendString(ca_cert_pem); |
| 895 properties->SetWithoutPathExpansion(shill::kOpenVPNCaCertPemProperty, | 898 properties->SetWithoutPathExpansion(shill::kOpenVPNCaCertPemProperty, |
| 896 pem_list); | 899 std::move(pem_list)); |
| 897 } | 900 } |
| 898 SetUserCertProperties(client_cert::CONFIG_TYPE_OPENVPN, properties); | 901 SetUserCertProperties(client_cert::CONFIG_TYPE_OPENVPN, properties); |
| 899 properties->SetStringWithoutPathExpansion( | 902 properties->SetStringWithoutPathExpansion( |
| 900 shill::kOpenVPNUserProperty, GetUsername()); | 903 shill::kOpenVPNUserProperty, GetUsername()); |
| 901 if (!user_passphrase.empty()) { | 904 if (!user_passphrase.empty()) { |
| 902 properties->SetStringWithoutPathExpansion( | 905 properties->SetStringWithoutPathExpansion( |
| 903 shill::kOpenVPNPasswordProperty, user_passphrase); | 906 shill::kOpenVPNPasswordProperty, user_passphrase); |
| 904 } | 907 } |
| 905 std::string otp = GetOTP(); | 908 std::string otp = GetOTP(); |
| 906 if (!otp.empty()) { | 909 if (!otp.empty()) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 property_ui_data->ParseOncProperty( | 1096 property_ui_data->ParseOncProperty( |
| 1094 onc_source, | 1097 onc_source, |
| 1095 onc, | 1098 onc, |
| 1096 base::StringPrintf("%s.%s.%s", | 1099 base::StringPrintf("%s.%s.%s", |
| 1097 ::onc::network_config::kVPN, | 1100 ::onc::network_config::kVPN, |
| 1098 dict_key.c_str(), | 1101 dict_key.c_str(), |
| 1099 key.c_str())); | 1102 key.c_str())); |
| 1100 } | 1103 } |
| 1101 | 1104 |
| 1102 } // namespace chromeos | 1105 } // namespace chromeos |
| OLD | NEW |