| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const std::string& guid, | 135 const std::string& guid, |
| 134 base::DictionaryValue* certificate); | 136 base::DictionaryValue* certificate); |
| 135 scoped_refptr<net::X509Certificate> ParseClientCertificate( | 137 scoped_refptr<net::X509Certificate> ParseClientCertificate( |
| 136 int cert_index, | 138 int cert_index, |
| 137 const std::string& guid, | 139 const std::string& guid, |
| 138 base::DictionaryValue* certificate); | 140 base::DictionaryValue* certificate); |
| 139 | 141 |
| 140 // Error message from the JSON parser, if applicable. | 142 // Error message from the JSON parser, if applicable. |
| 141 std::string parse_error_; | 143 std::string parse_error_; |
| 142 | 144 |
| 145 // Where the ONC blob comes from. |
| 146 NetworkUIData::ONCSource onc_source_; |
| 147 |
| 143 scoped_ptr<base::DictionaryValue> root_dict_; | 148 scoped_ptr<base::DictionaryValue> root_dict_; |
| 144 base::ListValue* network_configs_; | 149 base::ListValue* network_configs_; |
| 145 base::ListValue* certificates_; | 150 base::ListValue* certificates_; |
| 146 | 151 |
| 147 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); | 152 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 // Base for wireless networks. | 155 // Base for wireless networks. |
| 151 class OncWirelessNetworkParser : public OncNetworkParser { | 156 class OncWirelessNetworkParser : public OncNetworkParser { |
| 152 public: | 157 public: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const base::Value& value, | 226 const base::Value& value, |
| 222 Network* network); | 227 Network* network); |
| 223 | 228 |
| 224 private: | 229 private: |
| 225 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); | 230 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); |
| 226 }; | 231 }; |
| 227 | 232 |
| 228 } // namespace chromeos | 233 } // namespace chromeos |
| 229 | 234 |
| 230 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ | 235 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ |
| OLD | NEW |