| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 INITIALIZED, | 51 INITIALIZED, |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Converts a ContentOrigin constant to a string of its name. | 54 // Converts a ContentOrigin constant to a string of its name. |
| 55 std::string ContentOriginToString(ContentOrigin origin); | 55 std::string ContentOriginToString(ContentOrigin origin); |
| 56 | 56 |
| 57 // The root directory name used for the Google Drive file system tree. The | 57 // The root directory name used for the Google Drive file system tree. The |
| 58 // name is used in URLs for the file manager, hence user-visible. | 58 // name is used in URLs for the file manager, hence user-visible. |
| 59 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); | 59 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); |
| 60 | 60 |
| 61 // The resource ID for the root directory is defined in the spec: | 61 // The resource ID for the root directory for WAPI is defined in the spec: |
| 62 // https://developers.google.com/google-apps/documents-list/ | 62 // https://developers.google.com/google-apps/documents-list/ |
| 63 const char kDriveRootDirectoryResourceId[] = "folder:root"; | 63 // Note that this special ID only applies to WAPI. Drive uses a non-constant |
| 64 // unique ID given in About resource. |
| 65 const char kWAPIRootDirectoryResourceId[] = "folder:root"; |
| 64 | 66 |
| 65 // This should be incremented when incompatibility change is made in | 67 // This should be incremented when incompatibility change is made in |
| 66 // drive.proto. | 68 // drive.proto. |
| 67 const int32 kProtoVersion = 2; | 69 const int32 kProtoVersion = 2; |
| 68 | 70 |
| 69 // Used for file operations like removing files. | 71 // Used for file operations like removing files. |
| 70 typedef base::Callback<void(DriveFileError error)> | 72 typedef base::Callback<void(DriveFileError error)> |
| 71 FileOperationCallback; | 73 FileOperationCallback; |
| 72 | 74 |
| 73 // Callback similar to FileOperationCallback but with a given |file_path|. | 75 // Callback similar to FileOperationCallback but with a given |file_path|. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // Creates a DriveEntry from a google_apis::DocumentEntry. | 155 // Creates a DriveEntry from a google_apis::DocumentEntry. |
| 154 scoped_ptr<DriveEntry> FromDocumentEntry( | 156 scoped_ptr<DriveEntry> FromDocumentEntry( |
| 155 const google_apis::DocumentEntry& doc); | 157 const google_apis::DocumentEntry& doc); |
| 156 | 158 |
| 157 // Creates a DriveFile instance. | 159 // Creates a DriveFile instance. |
| 158 scoped_ptr<DriveFile> CreateDriveFile(); | 160 scoped_ptr<DriveFile> CreateDriveFile(); |
| 159 | 161 |
| 160 // Creates a DriveDirectory instance. | 162 // Creates a DriveDirectory instance. |
| 161 scoped_ptr<DriveDirectory> CreateDriveDirectory(); | 163 scoped_ptr<DriveDirectory> CreateDriveDirectory(); |
| 162 | 164 |
| 163 // Sets root directory resource id and initialize the root entry. | 165 // Sets root directory resource ID and put root to ResourceMap. |
| 164 void InitializeRootEntry(const std::string& root_id); | 166 void InitializeRootEntry(const std::string& id); |
| 165 | 167 |
| 166 // Add |doc entry| to directory with path |directory_path| and invoke the | 168 // Add |doc entry| to directory with path |directory_path| and invoke the |
| 167 // callback asynchronously. | 169 // callback asynchronously. |
| 168 // |callback| must not be null. | 170 // |callback| must not be null. |
| 169 void AddEntryToDirectory(const FilePath& directory_path, | 171 void AddEntryToDirectory(const FilePath& directory_path, |
| 170 scoped_ptr<google_apis::DocumentEntry> doc_entry, | 172 scoped_ptr<google_apis::DocumentEntry> doc_entry, |
| 171 const FileMoveCallback& callback); | 173 const FileMoveCallback& callback); |
| 172 | 174 |
| 173 // Moves entry specified by |file_path| to the directory specified by | 175 // Moves entry specified by |file_path| to the directory specified by |
| 174 // |directory_path| and calls the callback asynchronously. Removes the entry | 176 // |directory_path| and calls the callback asynchronously. Removes the entry |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // This should remain the last member so it'll be destroyed first and | 321 // This should remain the last member so it'll be destroyed first and |
| 320 // invalidate its weak pointers before other members are destroyed. | 322 // invalidate its weak pointers before other members are destroyed. |
| 321 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 323 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
| 322 | 324 |
| 323 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 325 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
| 324 }; | 326 }; |
| 325 | 327 |
| 326 } // namespace drive | 328 } // namespace drive |
| 327 | 329 |
| 328 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 330 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| OLD | NEW |