Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 14566009: Add NetworkConnectionHandler class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert Associating Stub change for test Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/i18n/icu_encoding_detection.h" 7 #include "base/i18n/icu_encoding_detection.h"
8 #include "base/i18n/icu_string_conversions.h" 8 #include "base/i18n/icu_string_conversions.h"
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/json/json_writer.h" // for debug output only. 10 #include "base/json/json_writer.h" // for debug output only.
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversion_utils.h" 12 #include "base/strings/utf_string_conversion_utils.h"
13 #include "chrome/browser/chromeos/cros/certificate_pattern_matcher.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "chrome/browser/chromeos/cros/native_network_constants.h" 14 #include "chrome/browser/chromeos/cros/native_network_constants.h"
16 #include "chrome/browser/chromeos/cros/native_network_parser.h" 15 #include "chrome/browser/chromeos/cros/native_network_parser.h"
17 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h" 16 #include "chrome/browser/chromeos/cros/network_library_impl_cros.h"
18 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" 17 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h"
19 #include "chrome/common/net/x509_certificate_model.h" 18 #include "chrome/common/net/x509_certificate_model.h"
20 #include "chromeos/network/certificate_pattern.h" 19 #include "chromeos/network/certificate_pattern.h"
20 #include "chromeos/network/certificate_pattern_matcher.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 "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "grit/ash_strings.h" 24 #include "grit/ash_strings.h"
25 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
26 #include "net/base/url_util.h" 26 #include "net/base/url_util.h"
27 #include "third_party/cros_system_api/dbus/service_constants.h" 27 #include "third_party/cros_system_api/dbus/service_constants.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 29
30 using content::BrowserThread; 30 using content::BrowserThread;
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 // We skip certificate patterns for device policy ONC so that an unmanaged 772 // We skip certificate patterns for device policy ONC so that an unmanaged
773 // user can't get to the place where a cert is presented for them 773 // user can't get to the place where a cert is presented for them
774 // involuntarily. 774 // involuntarily.
775 if (client_cert_pattern().Empty() || 775 if (client_cert_pattern().Empty() ||
776 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) { 776 ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY) {
777 connect.Run(); 777 connect.Run();
778 return; 778 return;
779 } 779 }
780 780
781 scoped_refptr<net::X509Certificate> matching_cert = 781 scoped_refptr<net::X509Certificate> matching_cert =
782 GetCertificateMatch(client_cert_pattern()); 782 certificate_pattern::GetCertificateMatch(client_cert_pattern());
783 if (matching_cert.get()) { 783 if (matching_cert.get()) {
784 std::string client_cert_id = 784 std::string client_cert_id =
785 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()); 785 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle());
786 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) { 786 if (provider_type() == PROVIDER_TYPE_OPEN_VPN) {
787 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty, 787 SetStringProperty(flimflam::kOpenVPNClientCertIdProperty,
788 client_cert_id, &client_cert_id_); 788 client_cert_id, &client_cert_id_);
789 } else { 789 } else {
790 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, 790 SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty,
791 client_cert_id, &client_cert_id_); 791 client_cert_id, &client_cert_id_);
792 } 792 }
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 void WifiNetwork::MatchCertificatePattern(bool allow_enroll, 1294 void WifiNetwork::MatchCertificatePattern(bool allow_enroll,
1295 const base::Closure& connect) { 1295 const base::Closure& connect) {
1296 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN); 1296 DCHECK(client_cert_type() == CLIENT_CERT_TYPE_PATTERN);
1297 DCHECK(!client_cert_pattern().Empty()); 1297 DCHECK(!client_cert_pattern().Empty());
1298 if (client_cert_pattern().Empty()) { 1298 if (client_cert_pattern().Empty()) {
1299 connect.Run(); 1299 connect.Run();
1300 return; 1300 return;
1301 } 1301 }
1302 1302
1303 scoped_refptr<net::X509Certificate> matching_cert = 1303 scoped_refptr<net::X509Certificate> matching_cert =
1304 GetCertificateMatch(client_cert_pattern()); 1304 certificate_pattern::GetCertificateMatch(client_cert_pattern());
1305 if (matching_cert.get()) { 1305 if (matching_cert.get()) {
1306 SetEAPClientCertPkcs11Id( 1306 SetEAPClientCertPkcs11Id(
1307 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle())); 1307 x509_certificate_model::GetPkcs11Id(matching_cert->os_cert_handle()));
1308 } else { 1308 } else {
1309 if (allow_enroll && enrollment_delegate()) { 1309 if (allow_enroll && enrollment_delegate()) {
1310 // Wrap the closure in another callback so that we can retry the 1310 // Wrap the closure in another callback so that we can retry the
1311 // certificate match again before actually connecting. 1311 // certificate match again before actually connecting.
1312 base::Closure wrapped_connect = 1312 base::Closure wrapped_connect =
1313 base::Bind(&WifiNetwork::MatchCertificatePattern, 1313 base::Bind(&WifiNetwork::MatchCertificatePattern,
1314 weak_pointer_factory_.GetWeakPtr(), 1314 weak_pointer_factory_.GetWeakPtr(),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 NetworkLibrary* impl; 1374 NetworkLibrary* impl;
1375 if (stub) 1375 if (stub)
1376 impl = new NetworkLibraryImplStub(); 1376 impl = new NetworkLibraryImplStub();
1377 else 1377 else
1378 impl = new NetworkLibraryImplCros(); 1378 impl = new NetworkLibraryImplCros();
1379 impl->Init(); 1379 impl->Init();
1380 return impl; 1380 return impl;
1381 } 1381 }
1382 1382
1383 } // namespace chromeos 1383 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/certificate_pattern_matcher.cc ('k') | chrome/browser/chromeos/cros/network_library_impl_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698