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/common/net/x509_certificate_model.h" | 18 #include "chrome/common/net/x509_certificate_model.h" |
19 #include "chromeos/network/certificate_pattern.h" | 19 #include "chromeos/network/certificate_pattern.h" |
20 #include "chromeos/network/certificate_pattern_matcher.h" | 20 #include "chromeos/network/client_cert_util.h" |
21 #include "chromeos/network/cros_network_functions.h" | 21 #include "chromeos/network/cros_network_functions.h" |
22 #include "chromeos/network/network_state_handler.h" | 22 #include "chromeos/network/network_state_handler.h" |
23 #include "chromeos/network/onc/onc_utils.h" | 23 #include "chromeos/network/onc/onc_utils.h" |
24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
25 #include "grit/ash_strings.h" | 25 #include "grit/ash_strings.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
27 #include "net/base/url_util.h" | 27 #include "net/base/url_util.h" |
28 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 | 30 |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 // We skip certificate patterns for device policy ONC so that an unmanaged | 761 // We skip certificate patterns for device policy ONC so that an unmanaged |
762 // user can't get to the place where a cert is presented for them | 762 // user can't get to the place where a cert is presented for them |
763 // involuntarily. | 763 // involuntarily. |
764 if (client_cert_pattern().Empty() || | 764 if (client_cert_pattern().Empty() || |
765 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) { | 765 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) { |
766 connect.Run(); | 766 connect.Run(); |
767 return; | 767 return; |
768 } | 768 } |
769 | 769 |
770 scoped_refptr<net::X509Certificate> matching_cert = | 770 scoped_refptr<net::X509Certificate> matching_cert = |
771 certificate_pattern::GetCertificateMatch(client_cert_pattern()); | 771 client_cert::GetCertificateMatch(client_cert_pattern()); |
772 if (matching_cert.get()) { | 772 if (matching_cert.get()) { |
773 std::string client_cert_id = | 773 std::string client_cert_id = |
774 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()); | 774 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()); |
775 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) { | 775 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) { |
776 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty, | 776 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty, |
777 client_cert_id, &client_cert_id_); | 777 client_cert_id, &client_cert_id_); |
778 } else { | 778 } else { |
779 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, | 779 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, |
780 client_cert_id, &client_cert_id_); | 780 client_cert_id, &client_cert_id_); |
781 } | 781 } |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 void WifiNetwork::MatchCertificatePattern(bool allow_enroll, | 1278 void WifiNetwork::MatchCertificatePattern(bool allow_enroll, |
1279 const base::Closure& connect) { | 1279 const base::Closure& connect) { |
1280 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN); | 1280 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN); |
1281 DCHECK(!client_cert_pattern().Empty()); | 1281 DCHECK(!client_cert_pattern().Empty()); |
1282 if (client_cert_pattern().Empty()) { | 1282 if (client_cert_pattern().Empty()) { |
1283 connect.Run(); | 1283 connect.Run(); |
1284 return; | 1284 return; |
1285 } | 1285 } |
1286 | 1286 |
1287 scoped_refptr<net::X509Certificate> matching_cert = | 1287 scoped_refptr<net::X509Certificate> matching_cert = |
1288 certificate_pattern::GetCertificateMatch(client_cert_pattern()); | 1288 client_cert::GetCertificateMatch(client_cert_pattern()); |
1289 if (matching_cert.get()) { | 1289 if (matching_cert.get()) { |
1290 SetEAPClientCertPkcs11Id( | 1290 SetEAPClientCertPkcs11Id( |
1291 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle())); | 1291 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle())); |
1292 } else { | 1292 } else { |
1293 if (allow_enroll && enrollment_delegate()) { | 1293 if (allow_enroll && enrollment_delegate()) { |
1294 // Wrap the closure in another callback so that we can retry the | 1294 // Wrap the closure in another callback so that we can retry the |
1295 // certificate match again before actually connecting. | 1295 // certificate match again before actually connecting. |
1296 base::Closure wrapped_connect = | 1296 base::Closure wrapped_connect = |
1297 base::Bind(&WifiNetwork::MatchCertificatePattern, | 1297 base::Bind(&WifiNetwork::MatchCertificatePattern, |
1298 weak_pointer_factory_.GetWeakPtr(), | 1298 weak_pointer_factory_.GetWeakPtr(), |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 } | 1386 } |
1387 | 1387 |
1388 // static | 1388 // static |
1389 void NetworkLibrary::SetForTesting(NetworkLibrary* library) { | 1389 void NetworkLibrary::SetForTesting(NetworkLibrary* library) { |
1390 if (g_network_library) | 1390 if (g_network_library) |
1391 delete g_network_library; | 1391 delete g_network_library; |
1392 g_network_library = library; | 1392 g_network_library = library; |
1393 } | 1393 } |
1394 | 1394 |
1395 } // namespace chromeos | 1395 } // namespace chromeos |
OLD | NEW |