Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_files.h |
| =================================================================== |
| --- chrome/browser/chromeos/gdata/gdata_files.h (revision 126063) |
| +++ chrome/browser/chromeos/gdata/gdata_files.h (working copy) |
| @@ -5,9 +5,11 @@ |
| #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
| #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILES_H_ |
| -#include <map> |
| #include <sys/stat.h> |
| +#include <map> |
| +#include <string> |
| + |
| #include "base/gtest_prod_util.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/singleton.h" |
| @@ -48,8 +50,14 @@ |
| const FilePath::StringType& original_file_name() const { |
| return original_file_name_; |
| } |
| + void set_original_file_name(const FilePath::StringType& name) { |
|
satorux1
2012/03/12 17:48:24
While you are at it, could you document the differ
Ben Chan
2012/03/13 00:29:21
Done.
|
| + original_file_name_ = name; |
| + } |
| void set_file_name(const FilePath::StringType& name) { file_name_ = name; } |
| + void set_parent(GDataDirectory* parent) { parent_ = parent; } |
|
satorux1
2012/03/12 17:48:24
Looks scary. Let's move this to protected: section
Ben Chan
2012/03/13 00:29:21
Done.
|
| + const std::string& resource() const { return resource_id_; } |
|
satorux1
2012/03/12 17:48:24
resource() -> resource_id().
Ben Chan
2012/03/13 00:29:21
Done.
|
| + |
| // The content URL is used for downloading regular files as is. |
| const GURL& content_url() const { return content_url_; } |
| @@ -61,10 +69,14 @@ |
| // class. |
| FilePath GetFilePath(); |
| + // Restores |file_name_| to the original file name before de-duplication. |
| + virtual void UseOriginalFileName(); |
| + |
| protected: |
| base::PlatformFileInfo file_info_; |
| FilePath::StringType file_name_; |
| FilePath::StringType original_file_name_; |
| + std::string resource_id_; |
| // Files with the same original name will be uniquely identified with this |
| // field so we can represent them with unique URLs/paths in File API layer. |
| // For example, two files in the same directory with the same name "Foo" |
| @@ -104,13 +116,16 @@ |
| const GURL& edit_url() const { return edit_url_; } |
| const std::string& content_mime_type() const { return content_mime_type_; } |
| const std::string& etag() const { return etag_; } |
| - const std::string& resource() const { return resource_id_; } |
| const std::string& id() const { return id_; } |
| const std::string& file_md5() const { return file_md5_; } |
| // Returns a bitmask of CacheState enum values. |
| int GetCacheState(); |
| + const std::string& document_extension() const { return document_extension_; } |
| bool is_hosted_document() const { return is_hosted_document_; } |
| + // GDataFileBase override. |
| + virtual void UseOriginalFileName() OVERRIDE; |
| + |
| private: |
| // Content URL for files. |
| DocumentEntry::EntryKind kind_; |
| @@ -118,9 +133,9 @@ |
| GURL edit_url_; |
| std::string content_mime_type_; |
| std::string etag_; |
| - std::string resource_id_; |
| std::string id_; |
| std::string file_md5_; |
| + std::string document_extension_; |
| bool is_hosted_document_; |
| DISALLOW_COPY_AND_ASSIGN(GDataFile); |
| @@ -143,6 +158,9 @@ |
| // the same name "Foo" will be renames to "Foo (1)" and "Foo (2)". |
| void AddFile(GDataFileBase* file); |
| + // Moves the file from its children list to the children list of |dir|. |
| + bool MoveFile(GDataFileBase* file, GDataDirectory* dir); |
|
satorux1
2012/03/12 17:48:24
Instead of this, what about adding a function like
Ben Chan
2012/03/13 00:29:21
Done.
|
| + |
| // Removes the file from its children list. |
| bool RemoveFile(GDataFileBase* file); |