OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <dbus/dbus-glib.h> | 7 #include <dbus/dbus-glib.h> |
8 #include <dbus/dbus-gtype-specialized.h> | 8 #include <dbus/dbus-gtype-specialized.h> |
9 #include <glib-object.h> | 9 #include <glib-object.h> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/chromeos/cros/native_network_constants.h" | 32 #include "chrome/browser/chromeos/cros/native_network_constants.h" |
33 #include "chrome/browser/chromeos/cros/native_network_parser.h" | 33 #include "chrome/browser/chromeos/cros/native_network_parser.h" |
34 #include "chrome/browser/chromeos/cros/network_ui_data.h" | 34 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
35 #include "chrome/browser/chromeos/cros/onc_network_parser.h" | 35 #include "chrome/browser/chromeos/cros/onc_network_parser.h" |
36 #include "chrome/browser/chromeos/cros_settings.h" | 36 #include "chrome/browser/chromeos/cros_settings.h" |
37 #include "chrome/browser/chromeos/network_login_observer.h" | 37 #include "chrome/browser/chromeos/network_login_observer.h" |
38 #include "chrome/common/time_format.h" | 38 #include "chrome/common/time_format.h" |
39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
40 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. | 40 #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. |
41 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
| 42 #include "net/base/x509_certificate.h" |
42 #include "third_party/cros_system_api/dbus/service_constants.h" | 43 #include "third_party/cros_system_api/dbus/service_constants.h" |
43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/text/bytes_formatting.h" | 45 #include "ui/base/text/bytes_formatting.h" |
45 | 46 |
46 using content::BrowserThread; | 47 using content::BrowserThread; |
47 | 48 |
48 //////////////////////////////////////////////////////////////////////////////// | 49 //////////////////////////////////////////////////////////////////////////////// |
49 // Implementation notes. | 50 // Implementation notes. |
50 // NetworkLibraryImpl manages a series of classes that describe network devices | 51 // NetworkLibraryImpl manages a series of classes that describe network devices |
51 // and services: | 52 // and services: |
(...skipping 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 } | 2833 } |
2833 } | 2834 } |
2834 | 2835 |
2835 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, | 2836 bool NetworkLibraryImplBase::LoadOncNetworks(const std::string& onc_blob, |
2836 const std::string& passcode) { | 2837 const std::string& passcode) { |
2837 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 | 2838 // TODO(gspencer): Add support for decrypting onc files. crbug.com/19397 |
2838 OncNetworkParser parser(onc_blob); | 2839 OncNetworkParser parser(onc_blob); |
2839 | 2840 |
2840 for (int i = 0; i < parser.GetCertificatesSize(); i++) { | 2841 for (int i = 0; i < parser.GetCertificatesSize(); i++) { |
2841 // Insert each of the available certs into the certificate DB. | 2842 // Insert each of the available certs into the certificate DB. |
2842 if (!parser.ParseCertificate(i)) { | 2843 if (parser.ParseCertificate(i).get() == NULL) { |
2843 DLOG(WARNING) << "Cannot parse certificate in ONC file"; | 2844 DLOG(WARNING) << "Cannot parse certificate in ONC file"; |
2844 return false; | 2845 return false; |
2845 } | 2846 } |
2846 } | 2847 } |
2847 | 2848 |
2848 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { | 2849 for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { |
2849 // Parse Open Network Configuration blob into a temporary Network object. | 2850 // Parse Open Network Configuration blob into a temporary Network object. |
2850 scoped_ptr<Network> network(parser.ParseNetwork(i)); | 2851 scoped_ptr<Network> network(parser.ParseNetwork(i)); |
2851 if (!network.get()) { | 2852 if (!network.get()) { |
2852 DLOG(WARNING) << "Cannot parse network in ONC file"; | 2853 DLOG(WARNING) << "Cannot parse network in ONC file"; |
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5341 return impl; | 5342 return impl; |
5342 } | 5343 } |
5343 | 5344 |
5344 ///////////////////////////////////////////////////////////////////////////// | 5345 ///////////////////////////////////////////////////////////////////////////// |
5345 | 5346 |
5346 } // namespace chromeos | 5347 } // namespace chromeos |
5347 | 5348 |
5348 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5349 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
5349 // won't be deleted until its last InvokeLater is run. | 5350 // won't be deleted until its last InvokeLater is run. |
5350 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 5351 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |