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

Unified Diff: chrome/browser/chromeos/gdata/drive_api_parser.h

Issue 10836205: Parse labels under File resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_api_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/drive_api_parser.h
diff --git a/chrome/browser/chromeos/gdata/drive_api_parser.h b/chrome/browser/chromeos/gdata/drive_api_parser.h
index 01a48ea6b6f1403159d6e666817790679565769d..0183fcbaf0ab84ed3535d12fc7f3e97d094f6171 100644
--- a/chrome/browser/chromeos/gdata/drive_api_parser.h
+++ b/chrome/browser/chromeos/gdata/drive_api_parser.h
@@ -299,6 +299,49 @@ class ParentReference {
DISALLOW_COPY_AND_ASSIGN(ParentReference);
};
+// FileLabels represents labels for file or folder.
+// https://developers.google.com/drive/v2/reference/files
+class FileLabels {
+ public:
+
+ ~FileLabels();
+
+ // Registers the mapping between JSON field names and the members in this
+ // class.
+ static void RegisterJSONConverter(
+ base::JSONValueConverter<FileLabels>* converter);
+
+ // Creates about resource from parsed JSON.
+ static scoped_ptr<FileLabels> CreateFrom(const base::Value& value);
+
+ // Whether this file is starred by the user.
+ bool is_starred() const { return starred_; }
+ // Whether this file is hidden from the user.
+ bool is_hidden() const { return hidden_; }
+ // Whether this file has been trashed.
+ bool is_trashed() const { return trashed_; }
+ // Whether viewers are prevented from downloading this file.
+ bool is_restricted() const { return restricted_; }
+ // Whether this file has been viewed by this user.
+ bool is_viewed() const { return viewed_; }
+
+ private:
+ friend class FileResource;
+ FileLabels();
+
+ // Parses and initializes data members from content of |value|.
+ // Return false if parsing fails.
+ bool Parse(const base::Value& value);
+
+ bool starred_;
+ bool hidden_;
+ bool trashed_;
+ bool restricted_;
+ bool viewed_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileLabels);
+};
+
// FileResource represents a file or folder metadata in Drive.
// https://developers.google.com/drive/v2/reference/files
class FileResource {
@@ -338,6 +381,9 @@ class FileResource {
// Returns MIME type of this file.
const std::string& mime_type() const { return mime_type_; }
+ // Returns labels for this file.
+ const FileLabels& labels() const { return labels_; }
+
// Returns created time of this file.
const base::Time& created_date() const { return created_date_; }
@@ -389,6 +435,7 @@ class FileResource {
GURL self_link_;
std::string title_;
std::string mime_type_;
+ FileLabels labels_;
base::Time created_date_;
base::Time modified_by_me_date_;
GURL download_url_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/drive_api_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698