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

Unified Diff: base/json_reader.h

Issue 42680: Add more of the server-side plumbing for extension APIs. Also (Closed)
Patch Set: Introduce SyncExtensionFunction Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browser.vcproj » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json_reader.h
diff --git a/base/json_reader.h b/base/json_reader.h
index ac4ca1aa416ea3b18ece9c661ec5505c0d43d7d6..9c4065be205792ff0701bc74f9e353df15a5854b 100644
--- a/base/json_reader.h
+++ b/base/json_reader.h
@@ -85,6 +85,8 @@ class JSONReader {
static const char* kUnsupportedEncoding;
static const char* kUnquotedDictionaryKey;
+ JSONReader();
+
// Reads and parses |json|, returning a Value. The caller owns the returned
// instance. If |json| is not a properly formed JSON string, returns NULL.
// If |allow_trailing_comma| is true, we will ignore trailing commas in
@@ -99,25 +101,29 @@ class JSONReader {
bool allow_trailing_comma,
std::string* error_message_out);
+ // Returns the error message if the last call to JsonToValue() failed. If the
+ // last call did not fail, returns a valid empty string.
+ std::string error_message() { return error_message_; }
+
+ // Reads and parses |json|, returning a Value. The caller owns the returned
+ // instance. If |json| is not a properly formed JSON string, returns NULL and
+ // a detailed error can be retrieved from |error_message()|.
+ // If |check_root| is true, we require that the root object be an object or
+ // array. Otherwise, it can be any valid JSON type.
+ // If |allow_trailing_comma| is true, we will ignore trailing commas in
+ // objects and arrays even though this goes against the RFC.
+ Value* JsonToValue(const std::string& json, bool check_root,
+ bool allow_trailing_comma);
+
private:
static std::string FormatErrorMessage(int line, int column,
const char* description);
- JSONReader();
DISALLOW_EVIL_CONSTRUCTORS(JSONReader);
FRIEND_TEST(JSONReaderTest, Reading);
FRIEND_TEST(JSONReaderTest, ErrorMessages);
- // Returns the error message if the last call to JsonToValue() failed. If the
- // last call did not fail, returns a valid empty string.
- std::string error_message() { return error_message_; }
-
- // Pass through method from JSONReader::Read. We have this so unittests can
- // disable the root check.
- Value* JsonToValue(const std::string& json, bool check_root,
- bool allow_trailing_comma);
-
// Recursively build Value. Returns NULL if we don't have a valid JSON
// string. If |is_root| is true, we verify that the root element is either
// an object or an array.
« no previous file with comments | « no previous file | chrome/browser/browser.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698