| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Call to parse and import the nth certificate in the certificate | 45 // Call to parse and import the nth certificate in the certificate |
| 46 // list. Returns false on failure. | 46 // list. Returns false on failure. |
| 47 bool ParseCertificate(int n); | 47 bool ParseCertificate(int n); |
| 48 | 48 |
| 49 // Parse a network into a PropertyMap. | 49 // Parse a network into a PropertyMap. |
| 50 bool ParseNetworkToPropertyMap(int n, PropertyMap* map); | 50 bool ParseNetworkToPropertyMap(int n, PropertyMap* map); |
| 51 | 51 |
| 52 virtual Network* CreateNetworkFromInfo(const std::string& service_path, | 52 virtual Network* CreateNetworkFromInfo(const std::string& service_path, |
| 53 const base::DictionaryValue& info) OVERRIDE; | 53 const base::DictionaryValue& info) OVERRIDE; |
| 54 | 54 |
| 55 const std::string& parse_error() { return parse_error_; } |
| 56 |
| 55 protected: | 57 protected: |
| 56 OncNetworkParser(); | 58 OncNetworkParser(); |
| 57 | 59 |
| 58 virtual Network* CreateNewNetwork(ConnectionType type, | 60 virtual Network* CreateNewNetwork(ConnectionType type, |
| 59 const std::string& service_path) OVERRIDE; | 61 const std::string& service_path) OVERRIDE; |
| 60 virtual ConnectionType ParseType(const std::string& type) OVERRIDE; | 62 virtual ConnectionType ParseType(const std::string& type) OVERRIDE; |
| 61 virtual ConnectionType ParseTypeFromDictionary( | 63 virtual ConnectionType ParseTypeFromDictionary( |
| 62 const base::DictionaryValue& info) OVERRIDE; | 64 const base::DictionaryValue& info) OVERRIDE; |
| 63 | 65 |
| 64 // Returns the type string from the dictionary of network values. | 66 // Returns the type string from the dictionary of network values. |
| 65 std::string GetTypeFromDictionary(const base::DictionaryValue& info); | 67 std::string GetTypeFromDictionary(const base::DictionaryValue& info); |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 bool ParseServerOrCaCertificate( | 70 bool ParseServerOrCaCertificate( |
| 69 int cert_index, | 71 int cert_index, |
| 70 const std::string& cert_type, | 72 const std::string& cert_type, |
| 71 base::DictionaryValue* certificate); | 73 base::DictionaryValue* certificate); |
| 72 bool ParseClientCertificate( | 74 bool ParseClientCertificate( |
| 73 int cert_index, | 75 int cert_index, |
| 74 base::DictionaryValue* certificate); | 76 base::DictionaryValue* certificate); |
| 75 | 77 |
| 78 // Error message from the JSON parser, if applicable. |
| 79 std::string parse_error_; |
| 80 |
| 76 scoped_ptr<base::DictionaryValue> root_dict_; | 81 scoped_ptr<base::DictionaryValue> root_dict_; |
| 77 base::ListValue* network_configs_; | 82 base::ListValue* network_configs_; |
| 78 base::ListValue* certificates_; | 83 base::ListValue* certificates_; |
| 79 | 84 |
| 80 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); | 85 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 // Base for wireless networks. | 88 // Base for wireless networks. |
| 84 class OncWirelessNetworkParser : public OncNetworkParser { | 89 class OncWirelessNetworkParser : public OncNetworkParser { |
| 85 public: | 90 public: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 const base::Value& value, | 129 const base::Value& value, |
| 125 VirtualNetwork* network); | 130 VirtualNetwork* network); |
| 126 ProviderType ParseProviderType(const std::string& type); | 131 ProviderType ParseProviderType(const std::string& type); |
| 127 private: | 132 private: |
| 128 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); | 133 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); |
| 129 }; | 134 }; |
| 130 | 135 |
| 131 } // namespace chromeos | 136 } // namespace chromeos |
| 132 | 137 |
| 133 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ | 138 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ |
| OLD | NEW |