| 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/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
| 6 | 6 |
| 7 #include "base/chromeos/chromeos_version.h" | 7 #include "base/chromeos/chromeos_version.h" |
| 8 #include "base/i18n/icu_encoding_detection.h" | 8 #include "base/i18n/icu_encoding_detection.h" |
| 9 #include "base/i18n/icu_string_conversions.h" | 9 #include "base/i18n/icu_string_conversions.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 11 #include "base/json/json_writer.h" // for debug output only. | 11 #include "base/json/json_writer.h" // for debug output only. |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/utf_string_conversion_utils.h" | 13 #include "base/strings/utf_string_conversion_utils.h" |
| 14 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 14 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
| 15 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 15 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
| 16 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" | 16 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" | 17 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" |
| 18 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 18 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 19 #include "chrome/common/net/x509_certificate_model.h" | 19 #include "chrome/common/net/x509_certificate_model.h" |
| 20 #include "chromeos/network/certificate_pattern.h" | 20 #include "chromeos/network/certificate_pattern.h" |
| 21 #include "chromeos/network/certificate_pattern_matcher.h" | 21 #include "chromeos/network/client_cert_util.h" |
| 22 #include "chromeos/network/cros_network_functions.h" | 22 #include "chromeos/network/cros_network_functions.h" |
| 23 #include "chromeos/network/network_state_handler.h" | 23 #include "chromeos/network/network_state_handler.h" |
| 24 #include "chromeos/network/onc/onc_utils.h" | 24 #include "chromeos/network/onc/onc_utils.h" |
| 25 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 26 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "net/base/url_util.h" | 28 #include "net/base/url_util.h" |
| 29 #include "third_party/cros_system_api/dbus/service_constants.h" | 29 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 | 31 |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // We skip certificate patterns for device policy ONC so that an unmanaged | 766 // We skip certificate patterns for device policy ONC so that an unmanaged |
| 767 // user can't get to the place where a cert is presented for them | 767 // user can't get to the place where a cert is presented for them |
| 768 // involuntarily. | 768 // involuntarily. |
| 769 if (client_cert_pattern().Empty() || | 769 if (client_cert_pattern().Empty() || |
| 770 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) { | 770 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) { |
| 771 connect.Run(); | 771 connect.Run(); |
| 772 return; | 772 return; |
| 773 } | 773 } |
| 774 | 774 |
| 775 scoped_refptr<net::X509Certificate> matching_cert = | 775 scoped_refptr<net::X509Certificate> matching_cert = |
| 776 certificate_pattern::GetCertificateMatch(client_cert_pattern()); | 776 client_cert::GetCertificateMatch(client_cert_pattern()); |
| 777 if (matching_cert.get()) { | 777 if (matching_cert.get()) { |
| 778 std::string client_cert_id = | 778 std::string client_cert_id = |
| 779 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()); | 779 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()); |
| 780 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) { | 780 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) { |
| 781 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty, | 781 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty, |
| 782 client_cert_id, &client_cert_id_); | 782 client_cert_id, &client_cert_id_); |
| 783 } else { | 783 } else { |
| 784 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, | 784 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, |
| 785 client_cert_id, &client_cert_id_); | 785 client_cert_id, &client_cert_id_); |
| 786 } | 786 } |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 void WifiNetwork::MatchCertificatePattern(bool allow_enroll, | 1283 void WifiNetwork::MatchCertificatePattern(bool allow_enroll, |
| 1284 const base::Closure& connect) { | 1284 const base::Closure& connect) { |
| 1285 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN); | 1285 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN); |
| 1286 DCHECK(!client_cert_pattern().Empty()); | 1286 DCHECK(!client_cert_pattern().Empty()); |
| 1287 if (client_cert_pattern().Empty()) { | 1287 if (client_cert_pattern().Empty()) { |
| 1288 connect.Run(); | 1288 connect.Run(); |
| 1289 return; | 1289 return; |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 scoped_refptr<net::X509Certificate> matching_cert = | 1292 scoped_refptr<net::X509Certificate> matching_cert = |
| 1293 certificate_pattern::GetCertificateMatch(client_cert_pattern()); | 1293 client_cert::GetCertificateMatch(client_cert_pattern()); |
| 1294 if (matching_cert.get()) { | 1294 if (matching_cert.get()) { |
| 1295 SetEAPClientCertPkcs11Id( | 1295 SetEAPClientCertPkcs11Id( |
| 1296 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle())); | 1296 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle())); |
| 1297 } else { | 1297 } else { |
| 1298 if (allow_enroll && enrollment_delegate()) { | 1298 if (allow_enroll && enrollment_delegate()) { |
| 1299 // Wrap the closure in another callback so that we can retry the | 1299 // Wrap the closure in another callback so that we can retry the |
| 1300 // certificate match again before actually connecting. | 1300 // certificate match again before actually connecting. |
| 1301 base::Closure wrapped_connect = | 1301 base::Closure wrapped_connect = |
| 1302 base::Bind(&WifiNetwork::MatchCertificatePattern, | 1302 base::Bind(&WifiNetwork::MatchCertificatePattern, |
| 1303 weak_pointer_factory_.GetWeakPtr(), | 1303 weak_pointer_factory_.GetWeakPtr(), |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 // static | 1393 // static |
| 1394 void NetworkLibrary::SetForTesting(NetworkLibrary* library) { | 1394 void NetworkLibrary::SetForTesting(NetworkLibrary* library) { |
| 1395 if (g_network_library) | 1395 if (g_network_library) |
| 1396 delete g_network_library; | 1396 delete g_network_library; |
| 1397 g_network_library = library; | 1397 g_network_library = library; |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 } // namespace chromeos | 1400 } // namespace chromeos |
| OLD | NEW |