| 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" // for OVERRIDE | 11 #include "base/compiler_specific.h" // for OVERRIDE |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/chromeos/cros/network_parser.h" | 15 #include "chrome/browser/chromeos/cros/network_parser.h" |
| 16 #include "chrome/browser/chromeos/cros/network_ui_data.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class DictionaryValue; | 19 class DictionaryValue; |
| 19 class ListValue; | 20 class ListValue; |
| 20 class Value; | 21 class Value; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 class X509Certificate; | 25 class X509Certificate; |
| 25 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 26 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 // | 45 // |
| 45 // For ONC file format, see: http://dev.chromium.org/chromium-os/ | 46 // For ONC file format, see: http://dev.chromium.org/chromium-os/ |
| 46 // chromiumos-design-docs/open-network-configuration | 47 // chromiumos-design-docs/open-network-configuration |
| 47 class OncNetworkParser : public NetworkParser { | 48 class OncNetworkParser : public NetworkParser { |
| 48 public: | 49 public: |
| 49 typedef bool (*ParserPointer)(OncNetworkParser*, | 50 typedef bool (*ParserPointer)(OncNetworkParser*, |
| 50 PropertyIndex, | 51 PropertyIndex, |
| 51 const base::Value&, | 52 const base::Value&, |
| 52 Network*); | 53 Network*); |
| 53 | 54 |
| 54 explicit OncNetworkParser(const std::string& onc_blob); | 55 OncNetworkParser(const std::string& onc_blob, |
| 56 NetworkUIData::ONCSource onc_source); |
| 55 virtual ~OncNetworkParser(); | 57 virtual ~OncNetworkParser(); |
| 56 static const EnumMapper<PropertyIndex>* property_mapper(); | 58 static const EnumMapper<PropertyIndex>* property_mapper(); |
| 57 | 59 |
| 58 // Returns the number of networks in the "NetworkConfigs" list. | 60 // Returns the number of networks in the "NetworkConfigs" list. |
| 59 int GetNetworkConfigsSize() const; | 61 int GetNetworkConfigsSize() const; |
| 60 | 62 |
| 61 // Call to create the network by parsing network config in the nth position. | 63 // Call to create the network by parsing network config in the nth position. |
| 62 // (0-based). Returns NULL if there's a parse error or if n is out of range. | 64 // (0-based). Returns NULL if there's a parse error or if n is out of range. |
| 63 Network* ParseNetwork(int n); | 65 Network* ParseNetwork(int n); |
| 64 | 66 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // certificate nickname (exact match). | 130 // certificate nickname (exact match). |
| 129 static void ListCertsWithNickname(const std::string& label, | 131 static void ListCertsWithNickname(const std::string& label, |
| 130 net::CertificateList* result); | 132 net::CertificateList* result); |
| 131 // This deletes any certificate that has the string |label| as its | 133 // This deletes any certificate that has the string |label| as its |
| 132 // nickname (exact match). | 134 // nickname (exact match). |
| 133 static bool DeleteCertAndKeyByNickname(const std::string& label); | 135 static bool DeleteCertAndKeyByNickname(const std::string& label); |
| 134 | 136 |
| 135 // Error message from the JSON parser, if applicable. | 137 // Error message from the JSON parser, if applicable. |
| 136 std::string parse_error_; | 138 std::string parse_error_; |
| 137 | 139 |
| 140 // Where the ONC blob comes from. |
| 141 NetworkUIData::ONCSource onc_source_; |
| 142 |
| 138 scoped_ptr<base::DictionaryValue> root_dict_; | 143 scoped_ptr<base::DictionaryValue> root_dict_; |
| 139 base::ListValue* network_configs_; | 144 base::ListValue* network_configs_; |
| 140 base::ListValue* certificates_; | 145 base::ListValue* certificates_; |
| 141 | 146 |
| 142 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); | 147 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); |
| 143 }; | 148 }; |
| 144 | 149 |
| 145 // Base for wireless networks. | 150 // Base for wireless networks. |
| 146 class OncWirelessNetworkParser : public OncNetworkParser { | 151 class OncWirelessNetworkParser : public OncNetworkParser { |
| 147 public: | 152 public: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 const base::Value& value, | 221 const base::Value& value, |
| 217 Network* network); | 222 Network* network); |
| 218 | 223 |
| 219 private: | 224 private: |
| 220 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); | 225 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); |
| 221 }; | 226 }; |
| 222 | 227 |
| 223 } // namespace chromeos | 228 } // namespace chromeos |
| 224 | 229 |
| 225 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ | 230 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ |
| OLD | NEW |