| 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 for WAPI is defined in the spec: | 61 // The resource ID for the root directory is defined in the spec: |
| 62 // https://developers.google.com/google-apps/documents-list/ | 62 // https://developers.google.com/google-apps/documents-list/ |
| 63 // Note that this special ID only applies to WAPI. Drive uses a non-constant | 63 const char kDriveRootDirectoryResourceId[] = "folder:root"; |
| 64 // unique ID given in About resource. | |
| 65 const char kWAPIRootDirectoryResourceId[] = "folder:root"; | |
| 66 | 64 |
| 67 // This should be incremented when incompatibility change is made in | 65 // This should be incremented when incompatibility change is made in |
| 68 // drive.proto. | 66 // drive.proto. |
| 69 const int32 kProtoVersion = 2; | 67 const int32 kProtoVersion = 2; |
| 70 | 68 |
| 71 // Used for file operations like removing files. | 69 // Used for file operations like removing files. |
| 72 typedef base::Callback<void(DriveFileError error)> | 70 typedef base::Callback<void(DriveFileError error)> |
| 73 FileOperationCallback; | 71 FileOperationCallback; |
| 74 | 72 |
| 75 // Callback similar to FileOperationCallback but with a given |file_path|. | 73 // Callback similar to FileOperationCallback but with a given |file_path|. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // The root directory content origin. | 149 // The root directory content origin. |
| 152 ContentOrigin origin() const { return origin_; } | 150 ContentOrigin origin() const { return origin_; } |
| 153 void set_origin(ContentOrigin value) { origin_ = value; } | 151 void set_origin(ContentOrigin value) { origin_ = value; } |
| 154 | 152 |
| 155 // Creates a DriveFile instance. | 153 // Creates a DriveFile instance. |
| 156 scoped_ptr<DriveFile> CreateDriveFile(); | 154 scoped_ptr<DriveFile> CreateDriveFile(); |
| 157 | 155 |
| 158 // Creates a DriveDirectory instance. | 156 // Creates a DriveDirectory instance. |
| 159 scoped_ptr<DriveDirectory> CreateDriveDirectory(); | 157 scoped_ptr<DriveDirectory> CreateDriveDirectory(); |
| 160 | 158 |
| 161 // Sets root directory resource ID and put root to ResourceMap. | 159 // Sets root directory resource id and initialize the root entry. |
| 162 void InitializeRootEntry(const std::string& id); | 160 void InitializeRootEntry(const std::string& root_id); |
| 163 | 161 |
| 164 // Add |doc entry| to directory with path |directory_path| and invoke the | 162 // Add |doc entry| to directory with path |directory_path| and invoke the |
| 165 // callback asynchronously. | 163 // callback asynchronously. |
| 166 // |callback| must not be null. | 164 // |callback| must not be null. |
| 167 void AddEntryToDirectory(const FilePath& directory_path, | 165 void AddEntryToDirectory(const FilePath& directory_path, |
| 168 scoped_ptr<google_apis::DocumentEntry> doc_entry, | 166 scoped_ptr<google_apis::DocumentEntry> doc_entry, |
| 169 const FileMoveCallback& callback); | 167 const FileMoveCallback& callback); |
| 170 | 168 |
| 171 // Moves entry specified by |file_path| to the directory specified by | 169 // Moves entry specified by |file_path| to the directory specified by |
| 172 // |directory_path| and calls the callback asynchronously. Removes the entry | 170 // |directory_path| and calls the callback asynchronously. Removes the entry |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // This should remain the last member so it'll be destroyed first and | 315 // This should remain the last member so it'll be destroyed first and |
| 318 // invalidate its weak pointers before other members are destroyed. | 316 // invalidate its weak pointers before other members are destroyed. |
| 319 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 317 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
| 320 | 318 |
| 321 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 319 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
| 322 }; | 320 }; |
| 323 | 321 |
| 324 } // namespace drive | 322 } // namespace drive |
| 325 | 323 |
| 326 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 324 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| OLD | NEW |