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

Unified Diff: chrome/browser/google_apis/drive_api_parser.cc

Issue 14160002: Add HasChangeListKind and HasFileListKind methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests Created 7 years, 8 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
Index: chrome/browser/google_apis/drive_api_parser.cc
diff --git a/chrome/browser/google_apis/drive_api_parser.cc b/chrome/browser/google_apis/drive_api_parser.cc
index ef94b850bfc403635a3072cdb48f42f534687761..56a04e928beaf230672fea199027be2be395e745 100644
--- a/chrome/browser/google_apis/drive_api_parser.cc
+++ b/chrome/browser/google_apis/drive_api_parser.cc
@@ -623,10 +623,14 @@ void FileList::RegisterJSONConverter(
}
// static
+bool FileList::HasFileListKind(const base::Value& value) {
+ return IsResourceKindExpected(value, kFileListKind);
+}
+
+// static
scoped_ptr<FileList> FileList::CreateFrom(const base::Value& value) {
scoped_ptr<FileList> resource(new FileList());
- if (!IsResourceKindExpected(value, kFileListKind) ||
- !resource->Parse(value)) {
+ if (!HasFileListKind(value) || !resource->Parse(value)) {
LOG(ERROR) << "Unable to create: Invalid FileList JSON!";
return scoped_ptr<FileList>(NULL);
}
@@ -703,10 +707,14 @@ void ChangeList::RegisterJSONConverter(
}
// static
+bool ChangeList::HasChangeListKind(const base::Value& value) {
+ return IsResourceKindExpected(value, kChangeListKind);
+}
+
+// static
scoped_ptr<ChangeList> ChangeList::CreateFrom(const base::Value& value) {
scoped_ptr<ChangeList> resource(new ChangeList());
- if (!IsResourceKindExpected(value, kChangeListKind) ||
- !resource->Parse(value)) {
+ if (!HasChangeListKind(value) || !resource->Parse(value)) {
LOG(ERROR) << "Unable to create: Invalid ChangeList JSON!";
return scoped_ptr<ChangeList>(NULL);
}
« no previous file with comments | « chrome/browser/google_apis/drive_api_parser.h ('k') | chrome/browser/google_apis/drive_api_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698