| 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 097f4b8565635563f2eb56846f939d149788f382..df2b4db01b07344e8804e810ff601a3443f49123 100644
|
| --- a/chrome/browser/chromeos/gdata/drive_api_parser.h
|
| +++ b/chrome/browser/chromeos/gdata/drive_api_parser.h
|
| @@ -257,6 +257,113 @@ class AppList {
|
| DISALLOW_COPY_AND_ASSIGN(AppList);
|
| };
|
|
|
| +// FileResource reporesents a file or folder metadata in Drive.
|
| +// https://developers.google.com/drive/v2/reference/files
|
| +class FileResource {
|
| + public:
|
| + ~FileResource();
|
| +
|
| + // Registers the mapping between JSON field names and the members in this
|
| + // class.
|
| + static void RegisterJSONConverter(
|
| + base::JSONValueConverter<FileResource>* converter);
|
| + static scoped_ptr<FileResource> CreateFrom(const base::Value& value);
|
| +
|
| + // Returns true if this is a folder.
|
| + bool IsFolder() const;
|
| +
|
| + // Returns file ID.
|
| + const std::string& id() const { return id_; }
|
| +
|
| + // Returns ETag for this file.
|
| + const std::string& etag() const { return etag_; }
|
| +
|
| + // Returns MIME type of this file.
|
| + const std::string& mime_type() const { return mime_type_; }
|
| +
|
| + // Returns the title of this file.
|
| + const std::string& title() const { return title_; }
|
| +
|
| + // Returns modification time by the user.
|
| + const base::Time& modified_by_me_date() const { return modified_by_me_date_; }
|
| +
|
| + // Returns the download URL.
|
| + const GURL& download_url() const { return download_url_; }
|
| +
|
| + // Returns the extension part of the filename.
|
| + const std::string& file_extension() const { return file_extension_; }
|
| +
|
| + // Returns MD5 checksum of this file.
|
| + const std::string& md5_checksum() const { return md5_checksum_; }
|
| +
|
| + // Returns the size of this file in bytes.
|
| + int64 file_size() const { return file_size_; }
|
| +
|
| + private:
|
| + friend class base::internal::RepeatedMessageConverter<FileResource>;
|
| + friend class FileList;
|
| + FileResource();
|
| +
|
| + // Parses and initializes data members from content of |value|.
|
| + // Return false if parsing fails.
|
| + bool Parse(const base::Value& value);
|
| +
|
| + std::string id_;
|
| + std::string etag_;
|
| + std::string mime_type_;
|
| + std::string title_;
|
| + base::Time modified_by_me_date_;
|
| + GURL download_url_;
|
| + std::string file_extension_;
|
| + std::string md5_checksum_;
|
| + int64 file_size_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FileResource);
|
| +};
|
| +
|
| +// FileList represents a collection of files and folders.
|
| +// https://developers.google.com/drive/v2/reference/files/list
|
| +class FileList {
|
| + public:
|
| + ~FileList();
|
| +
|
| + // Registers the mapping between JSON field names and the members in this
|
| + // class.
|
| + static void RegisterJSONConverter(
|
| + base::JSONValueConverter<FileList>* converter);
|
| + static scoped_ptr<FileList> CreateFrom(const base::Value& value);
|
| +
|
| + // Returns the ETag of the list.
|
| + const std::string& etag() const { return etag_; }
|
| +
|
| + // Returns the page token for the next page of files, if the list is large
|
| + // to fit in one response. If this is empty, there is no more file lists.
|
| + const std::string& next_page_token() const { return next_page_token_; }
|
| +
|
| + // Returns a link to the next page of files. This includes the next page
|
| + // token.
|
| + const GURL& next_link() const { return next_link_; }
|
| +
|
| + // Returns a set of files in this list.
|
| + const ScopedVector<FileResource>& items() const { return items_; }
|
| +
|
| + private:
|
| + friend class DriveAPIParserTest;
|
| + FRIEND_TEST_ALL_PREFIXES(DriveAPIParserTest, FileListParser);
|
| + FileList();
|
| +
|
| + // Parses and initializes data members from content of |value|.
|
| + // Return false if parsing fails.
|
| + bool Parse(const base::Value& value);
|
| +
|
| + std::string etag_;
|
| + std::string next_page_token_;
|
| + GURL next_link_;
|
| + ScopedVector<FileResource> items_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(FileList);
|
| +};
|
| +
|
| } // namespace gdata
|
|
|
| #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_API_PARSER_H_
|
|
|