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

Side by Side Diff: chrome/browser/chromeos/cros/onc_network_parser.h

Issue 8480003: Surface error messages from ONC parsing in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased version with password stripping. Created 9 years, 1 month 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) 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // (0-based). Returns NULL if there's a parse error or if n is out of range. 42 // (0-based). Returns NULL if there's a parse error or if n is out of range.
43 Network* ParseNetwork(int n); 43 Network* ParseNetwork(int n);
44 44
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 virtual Network* CreateNetworkFromInfo(const std::string& service_path, 49 virtual Network* CreateNetworkFromInfo(const std::string& service_path,
50 const base::DictionaryValue& info) OVERRIDE; 50 const base::DictionaryValue& info) OVERRIDE;
51 51
52 const std::string& parse_error() const { return parse_error_; }
53
52 protected: 54 protected:
53 OncNetworkParser(); 55 OncNetworkParser();
54 56
55 virtual Network* CreateNewNetwork(ConnectionType type, 57 virtual Network* CreateNewNetwork(ConnectionType type,
56 const std::string& service_path) OVERRIDE; 58 const std::string& service_path) OVERRIDE;
57 virtual ConnectionType ParseType(const std::string& type) OVERRIDE; 59 virtual ConnectionType ParseType(const std::string& type) OVERRIDE;
58 virtual ConnectionType ParseTypeFromDictionary( 60 virtual ConnectionType ParseTypeFromDictionary(
59 const base::DictionaryValue& info) OVERRIDE; 61 const base::DictionaryValue& info) OVERRIDE;
60 62
61 // Returns the type string from the dictionary of network values. 63 // Returns the type string from the dictionary of network values.
62 std::string GetTypeFromDictionary(const base::DictionaryValue& info); 64 std::string GetTypeFromDictionary(const base::DictionaryValue& info);
63 65
64 private: 66 private:
65 bool ParseServerOrCaCertificate( 67 bool ParseServerOrCaCertificate(
66 int cert_index, 68 int cert_index,
67 const std::string& cert_type, 69 const std::string& cert_type,
68 base::DictionaryValue* certificate); 70 base::DictionaryValue* certificate);
69 bool ParseClientCertificate( 71 bool ParseClientCertificate(
70 int cert_index, 72 int cert_index,
71 base::DictionaryValue* certificate); 73 base::DictionaryValue* certificate);
72 74
75 // Error message from the JSON parser, if applicable.
76 std::string parse_error_;
77
73 scoped_ptr<base::DictionaryValue> root_dict_; 78 scoped_ptr<base::DictionaryValue> root_dict_;
74 base::ListValue* network_configs_; 79 base::ListValue* network_configs_;
75 base::ListValue* certificates_; 80 base::ListValue* certificates_;
76 81
77 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser); 82 DISALLOW_COPY_AND_ASSIGN(OncNetworkParser);
78 }; 83 };
79 84
80 // Base for wireless networks. 85 // Base for wireless networks.
81 class OncWirelessNetworkParser : public OncNetworkParser { 86 class OncWirelessNetworkParser : public OncNetworkParser {
82 public: 87 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 const base::Value& value, 126 const base::Value& value,
122 VirtualNetwork* network); 127 VirtualNetwork* network);
123 ProviderType ParseProviderType(const std::string& type); 128 ProviderType ParseProviderType(const std::string& type);
124 private: 129 private:
125 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser); 130 DISALLOW_COPY_AND_ASSIGN(OncVirtualNetworkParser);
126 }; 131 };
127 132
128 } // namespace chromeos 133 } // namespace chromeos
129 134
130 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_ 135 #endif // CHROME_BROWSER_CHROMEOS_CROS_ONC_NETWORK_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698