| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // a hosted document. | 41 // a hosted document. |
| 42 enum DriveFileType { | 42 enum DriveFileType { |
| 43 REGULAR_FILE, | 43 REGULAR_FILE, |
| 44 HOSTED_DOCUMENT, | 44 HOSTED_DOCUMENT, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // The root directory name used for the Google Drive file system tree. The | 47 // The root directory name used for the Google Drive file system tree. The |
| 48 // name is used in URLs for the file manager, hence user-visible. | 48 // name is used in URLs for the file manager, hence user-visible. |
| 49 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); | 49 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); |
| 50 | 50 |
| 51 // The resource ID for the root directory is defined in the spec: | 51 // The resource ID for the root directory for WAPI is defined in the spec: |
| 52 // https://developers.google.com/google-apps/documents-list/ | 52 // https://developers.google.com/google-apps/documents-list/ |
| 53 const char kDriveRootDirectoryResourceId[] = "folder:root"; | 53 // Note that this special ID only applies to WAPI. Drive uses a non-constant |
| 54 // unique ID given in About resource. |
| 55 const char kWAPIRootDirectoryResourceId[] = "folder:root"; |
| 54 | 56 |
| 55 // This should be incremented when incompatibility change is made in | 57 // This should be incremented when incompatibility change is made in |
| 56 // drive.proto. | 58 // drive.proto. |
| 57 const int32 kProtoVersion = 2; | 59 const int32 kProtoVersion = 2; |
| 58 | 60 |
| 59 // Used for file operations like removing files. | 61 // Used for file operations like removing files. |
| 60 typedef base::Callback<void(DriveFileError error)> | 62 typedef base::Callback<void(DriveFileError error)> |
| 61 FileOperationCallback; | 63 FileOperationCallback; |
| 62 | 64 |
| 63 // Callback similar to FileOperationCallback but with a given |file_path|. | 65 // Callback similar to FileOperationCallback but with a given |file_path|. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 140 |
| 139 bool initialized() const { return initialized_; } | 141 bool initialized() const { return initialized_; } |
| 140 void set_initialized(bool initialized) { initialized_ = initialized; } | 142 void set_initialized(bool initialized) { initialized_ = initialized; } |
| 141 | 143 |
| 142 // Creates a DriveFile instance. | 144 // Creates a DriveFile instance. |
| 143 scoped_ptr<DriveFile> CreateDriveFile(); | 145 scoped_ptr<DriveFile> CreateDriveFile(); |
| 144 | 146 |
| 145 // Creates a DriveDirectory instance. | 147 // Creates a DriveDirectory instance. |
| 146 scoped_ptr<DriveDirectory> CreateDriveDirectory(); | 148 scoped_ptr<DriveDirectory> CreateDriveDirectory(); |
| 147 | 149 |
| 148 // Sets root directory resource id and initialize the root entry. | 150 // Sets root directory resource ID and put root to ResourceMap. |
| 149 void InitializeRootEntry(const std::string& root_id); | 151 void InitializeRootEntry(const std::string& id); |
| 150 | 152 |
| 151 // Add |doc entry| to directory with path |directory_path| and invoke the | 153 // Add |doc entry| to directory with path |directory_path| and invoke the |
| 152 // callback asynchronously. | 154 // callback asynchronously. |
| 153 // |callback| must not be null. | 155 // |callback| must not be null. |
| 154 void AddEntryToDirectory(const FilePath& directory_path, | 156 void AddEntryToDirectory(const FilePath& directory_path, |
| 155 scoped_ptr<google_apis::DocumentEntry> doc_entry, | 157 scoped_ptr<google_apis::DocumentEntry> doc_entry, |
| 156 const FileMoveCallback& callback); | 158 const FileMoveCallback& callback); |
| 157 | 159 |
| 158 // Moves entry specified by |file_path| to the directory specified by | 160 // Moves entry specified by |file_path| to the directory specified by |
| 159 // |directory_path| and calls the callback asynchronously. Removes the entry | 161 // |directory_path| and calls the callback asynchronously. Removes the entry |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // This should remain the last member so it'll be destroyed first and | 306 // This should remain the last member so it'll be destroyed first and |
| 305 // invalidate its weak pointers before other members are destroyed. | 307 // invalidate its weak pointers before other members are destroyed. |
| 306 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 308 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
| 307 | 309 |
| 308 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 310 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
| 309 }; | 311 }; |
| 310 | 312 |
| 311 } // namespace drive | 313 } // namespace drive |
| 312 | 314 |
| 313 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 315 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| OLD | NEW |