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

Side by Side Diff: base/values.h

Issue 251093: Modify extension request IPC messages to pass a ListValue instead of a string. (Closed)
Patch Set: notreached messages Created 11 years, 2 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
« no previous file with comments | « no previous file | base/values.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file specifies a recursive data storage class called Value 5 // This file specifies a recursive data storage class called Value
6 // intended for storing setting and other persistable data. 6 // intended for storing setting and other persistable data.
7 // It includes the ability to specify (recursive) lists and dictionaries, so 7 // It includes the ability to specify (recursive) lists and dictionaries, so
8 // it's fairly expressive. However, the API is optimized for the common case, 8 // it's fairly expressive. However, the API is optimized for the common case,
9 // namely storing a hierarchical tree of simple values. Given a 9 // namely storing a hierarchical tree of simple values. Given a
10 // DictionaryValue root, you can easily do things like: 10 // DictionaryValue root, you can easily do things like:
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 public: 164 public:
165 // Creates a Value to represent a binary buffer. The new object takes 165 // Creates a Value to represent a binary buffer. The new object takes
166 // ownership of the pointer passed in, if successful. 166 // ownership of the pointer passed in, if successful.
167 // Returns NULL if buffer is NULL. 167 // Returns NULL if buffer is NULL.
168 static BinaryValue* Create(char* buffer, size_t size); 168 static BinaryValue* Create(char* buffer, size_t size);
169 169
170 // For situations where you want to keep ownership of your buffer, this 170 // For situations where you want to keep ownership of your buffer, this
171 // factory method creates a new BinaryValue by copying the contents of the 171 // factory method creates a new BinaryValue by copying the contents of the
172 // buffer that's passed in. 172 // buffer that's passed in.
173 // Returns NULL if buffer is NULL. 173 // Returns NULL if buffer is NULL.
174 static BinaryValue* CreateWithCopiedBuffer(char* buffer, size_t size); 174 static BinaryValue* CreateWithCopiedBuffer(const char* buffer, size_t size);
175 175
176 ~BinaryValue(); 176 ~BinaryValue();
177 177
178 // Subclassed methods 178 // Subclassed methods
179 Value* DeepCopy() const; 179 Value* DeepCopy() const;
180 virtual bool Equals(const Value* other) const; 180 virtual bool Equals(const Value* other) const;
181 181
182 size_t GetSize() const { return size_; } 182 size_t GetSize() const { return size_; }
183 char* GetBuffer() { return buffer_; } 183 char* GetBuffer() { return buffer_; }
184 const char* GetBuffer() const { return buffer_; }
184 185
185 private: 186 private:
186 // Constructor is private so that only objects with valid buffer pointers 187 // Constructor is private so that only objects with valid buffer pointers
187 // and size values can be created. 188 // and size values can be created.
188 BinaryValue(char* buffer, size_t size); 189 BinaryValue(char* buffer, size_t size);
189 190
190 char* buffer_; 191 char* buffer_;
191 size_t size_; 192 size_t size_;
192 193
193 DISALLOW_COPY_AND_ASSIGN(BinaryValue); 194 DISALLOW_COPY_AND_ASSIGN(BinaryValue);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 virtual bool Serialize(const Value& root) = 0; 372 virtual bool Serialize(const Value& root) = 0;
372 373
373 // This method deserializes the subclass-specific format into a Value object. 374 // This method deserializes the subclass-specific format into a Value object.
374 // If the return value is non-NULL, the caller takes ownership of returned 375 // If the return value is non-NULL, the caller takes ownership of returned
375 // Value. If the return value is NULL, and if error_message is non-NULL, 376 // Value. If the return value is NULL, and if error_message is non-NULL,
376 // error_message should be filled with a message describing the error. 377 // error_message should be filled with a message describing the error.
377 virtual Value* Deserialize(std::string* error_message) = 0; 378 virtual Value* Deserialize(std::string* error_message) = 0;
378 }; 379 };
379 380
380 #endif // BASE_VALUES_H_ 381 #endif // BASE_VALUES_H_
OLDNEW
« no previous file with comments | « no previous file | base/values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698