Chromium Code Reviews| 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..d1b65827cfcc257358fb392c5aa38538b3639963 100644 |
| --- a/chrome/browser/chromeos/gdata/drive_api_parser.h |
| +++ b/chrome/browser/chromeos/gdata/drive_api_parser.h |
| @@ -257,6 +257,111 @@ class AppList { |
| DISALLOW_COPY_AND_ASSIGN(AppList); |
| }; |
| +// FileResource reporesents a file in Drive. |
|
satorux1
2012/07/27 23:03:11
a file or a directory? This class contains IsFolde
kochi
2012/07/30 07:46:53
I agree that this might be a confusing name, but I
satorux1
2012/07/30 09:01:13
Here's the background about my concern:
We origin
|
| +// 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; |
|
satorux1
2012/07/27 23:03:11
IsDirectory()?
kochi
2012/07/30 07:46:53
The term "directory" is never used in Drive API do
satorux1
2012/07/30 09:01:13
I think we should use the term "directory" in most
|
| + |
| + // Returns file ID. |
| + const std::string& id() const { return id_; } |
|
satorux1
2012/07/27 23:03:11
Is this equivalent of resource ID? maybe resource_
kochi
2012/07/30 07:46:53
No, this is different from old WAPI's resource ID.
satorux1
2012/07/30 09:01:13
But the purpose is the same? If so, please also me
|
| + |
| + // 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. |
|
satorux1
2012/07/27 23:03:11
File is a not good name if it means file or direct
kochi
2012/07/30 07:46:53
The same for FileResource. Updated the class comm
|
| +// 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. |
|
satorux1
2012/07/27 23:03:11
how does it look like? what's the "page token"? pl
kochi
2012/07/30 07:46:53
Added more comments, and also added checks in unit
|
| + const std::string& next_page_token() const { return next_page_token_; } |
| + |
| + // Returns a link to the next page of files. |
| + 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_ |