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

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

Issue 7753020: Revert recent changes to base::Value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months 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_NETWORK_PARSER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <map> 10 #include <map>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // Subclasses of this can then customize its methods to parse either 76 // Subclasses of this can then customize its methods to parse either
77 // libcros (flimflam) data or network setup information obtained from 77 // libcros (flimflam) data or network setup information obtained from
78 // policy or setup file import depending on the EnumMapper supplied. 78 // policy or setup file import depending on the EnumMapper supplied.
79 class NetworkDeviceParser { 79 class NetworkDeviceParser {
80 public: 80 public:
81 virtual NetworkDevice* CreateDeviceFromInfo(const std::string& device_path, 81 virtual NetworkDevice* CreateDeviceFromInfo(const std::string& device_path,
82 const DictionaryValue& info); 82 const DictionaryValue& info);
83 virtual bool UpdateDeviceFromInfo(const DictionaryValue& info, 83 virtual bool UpdateDeviceFromInfo(const DictionaryValue& info,
84 NetworkDevice* device); 84 NetworkDevice* device);
85 virtual bool UpdateStatus(const std::string& key, 85 virtual bool UpdateStatus(const std::string& key,
86 Value* value, 86 const Value& value,
87 NetworkDevice* device, 87 NetworkDevice* device,
88 PropertyIndex* index); 88 PropertyIndex* index);
89
90 protected: 89 protected:
91 // The NetworkDeviceParser does not take ownership of the |mapper|. 90 // The NetworkDeviceParser does not take ownership of the |mapper|.
92 explicit NetworkDeviceParser(const EnumMapper<PropertyIndex>* mapper); 91 explicit NetworkDeviceParser(const EnumMapper<PropertyIndex>* mapper);
93 virtual ~NetworkDeviceParser(); 92 virtual ~NetworkDeviceParser();
94 93
95 virtual bool ParseValue(PropertyIndex index, 94 virtual bool ParseValue(PropertyIndex index,
96 Value* value, 95 const Value& value,
97 NetworkDevice* device) = 0; 96 NetworkDevice* device) = 0;
98 virtual ConnectionType ParseType(const std::string& type) = 0; 97 virtual ConnectionType ParseType(const std::string& type) = 0;
99 98
100 const EnumMapper<PropertyIndex>& mapper() const { 99 const EnumMapper<PropertyIndex>& mapper() const {
101 return *mapper_; 100 return *mapper_;
102 } 101 }
103 102
104 private: 103 private:
105 const EnumMapper<PropertyIndex>* mapper_; 104 const EnumMapper<PropertyIndex>* mapper_;
106 DISALLOW_COPY_AND_ASSIGN(NetworkDeviceParser); 105 DISALLOW_COPY_AND_ASSIGN(NetworkDeviceParser);
(...skipping 12 matching lines...) Expand all
119 // Called when an existing network is has new information that needs 118 // Called when an existing network is has new information that needs
120 // to be updated. Returns false upon failure. 119 // to be updated. Returns false upon failure.
121 virtual bool UpdateNetworkFromInfo(const DictionaryValue& info, 120 virtual bool UpdateNetworkFromInfo(const DictionaryValue& info,
122 Network* network); 121 Network* network);
123 122
124 // Called when an individual attribute of an existing network has 123 // Called when an individual attribute of an existing network has
125 // changed. |index| is a return value that supplies the appropriate 124 // changed. |index| is a return value that supplies the appropriate
126 // property index for the given key. |index| is filled in even if 125 // property index for the given key. |index| is filled in even if
127 // the update fails. Returns false upon failure. 126 // the update fails. Returns false upon failure.
128 virtual bool UpdateStatus(const std::string& key, 127 virtual bool UpdateStatus(const std::string& key,
129 Value* value, 128 const Value& value,
130 Network* network, 129 Network* network,
131 PropertyIndex* index); 130 PropertyIndex* index);
132 protected: 131 protected:
133 // The NetworkParser does not take ownership of the |mapper|. 132 // The NetworkParser does not take ownership of the |mapper|.
134 explicit NetworkParser(const EnumMapper<PropertyIndex>* mapper); 133 explicit NetworkParser(const EnumMapper<PropertyIndex>* mapper);
135 virtual ~NetworkParser(); 134 virtual ~NetworkParser();
136 135
137 virtual bool ParseValue(PropertyIndex index, 136 virtual bool ParseValue(PropertyIndex index,
138 Value* value, 137 const Value& value,
139 Network* network) = 0; 138 Network* network) = 0;
140 virtual ConnectionType ParseType(const std::string& type) = 0; 139 virtual ConnectionType ParseType(const std::string& type) = 0;
141 virtual ConnectionType ParseTypeFromDictionary( 140 virtual ConnectionType ParseTypeFromDictionary(
142 const DictionaryValue& info) = 0; 141 const DictionaryValue& info) = 0;
143 virtual ConnectionMode ParseMode(const std::string& mode) = 0; 142 virtual ConnectionMode ParseMode(const std::string& mode) = 0;
144 virtual ConnectionState ParseState(const std::string& state) = 0; 143 virtual ConnectionState ParseState(const std::string& state) = 0;
145 virtual ConnectionError ParseError(const std::string& error) = 0; 144 virtual ConnectionError ParseError(const std::string& error) = 0;
146 145
147 const EnumMapper<PropertyIndex>& mapper() const { 146 const EnumMapper<PropertyIndex>& mapper() const {
148 return *mapper_; 147 return *mapper_;
149 } 148 }
150 149
151 private: 150 private:
152 const EnumMapper<PropertyIndex>* mapper_; 151 const EnumMapper<PropertyIndex>* mapper_;
153 DISALLOW_COPY_AND_ASSIGN(NetworkParser); 152 DISALLOW_COPY_AND_ASSIGN(NetworkParser);
154 }; 153 };
155 154
156 } // namespace chromeos 155 } // namespace chromeos
157 156
158 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_ 157 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_PARSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.cc ('k') | chrome/browser/chromeos/cros/network_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698