summaryrefslogtreecommitdiffstats
path: root/base/json_reader.h
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-28 19:56:51 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-28 19:56:51 +0000
commit703e807a70e50e32b3c4821c84c23bde69f73272 (patch)
tree615d9f7d150e5ec51821a892eecc8ebdb269b447 /base/json_reader.h
parenta137bdac37451b1b218cf4c43a798aa3abd4c875 (diff)
downloadchromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.zip
chromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.tar.gz
chromium_src-703e807a70e50e32b3c4821c84c23bde69f73272.tar.bz2
Add more of the server-side plumbing for extension APIs. Also
added getTabsForWindow() to drive it. Review URL: http://codereview.chromium.org/42680 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json_reader.h')
-rw-r--r--base/json_reader.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/base/json_reader.h b/base/json_reader.h
index ac4ca1a..9c4065b 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.