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_GDATA_DRIVE_RESOURCE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_RESOURCE_METADATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_RESOURCE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); | 57 const FilePath::CharType kDriveRootDirectory[] = FILE_PATH_LITERAL("drive"); |
58 | 58 |
59 // The resource ID for the root directory is defined in the spec: | 59 // The resource ID for the root directory is defined in the spec: |
60 // https://developers.google.com/google-apps/documents-list/ | 60 // https://developers.google.com/google-apps/documents-list/ |
61 const char kDriveRootDirectoryResourceId[] = "folder:root"; | 61 const char kDriveRootDirectoryResourceId[] = "folder:root"; |
62 | 62 |
63 // This should be incremented when incompatibility change is made in | 63 // This should be incremented when incompatibility change is made in |
64 // drive.proto. | 64 // drive.proto. |
65 const int32 kProtoVersion = 2; | 65 const int32 kProtoVersion = 2; |
66 | 66 |
67 // Callback type used to get result of file search. | |
68 // If |error| is not PLATFORM_FILE_OK, |entry| is set to NULL. | |
69 typedef base::Callback<void(DriveFileError error, DriveEntry* entry)> | |
70 FindEntryCallback; | |
71 | |
72 // Used for file operations like removing files. | 67 // Used for file operations like removing files. |
73 typedef base::Callback<void(DriveFileError error)> | 68 typedef base::Callback<void(DriveFileError error)> |
74 FileOperationCallback; | 69 FileOperationCallback; |
75 | 70 |
76 // Callback similar to FileOperationCallback but with a given |file_path|. | 71 // Callback similar to FileOperationCallback but with a given |file_path|. |
77 // Used for operations that change a file path like moving files. | 72 // Used for operations that change a file path like moving files. |
78 typedef base::Callback<void(DriveFileError error, | 73 typedef base::Callback<void(DriveFileError error, |
79 const FilePath& file_path)> | 74 const FilePath& file_path)> |
80 FileMoveCallback; | 75 FileMoveCallback; |
81 | 76 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 156 |
162 // Creates a DriveFile instance. | 157 // Creates a DriveFile instance. |
163 DriveFile* CreateDriveFile(); | 158 DriveFile* CreateDriveFile(); |
164 | 159 |
165 // Creates a DriveDirectory instance. | 160 // Creates a DriveDirectory instance. |
166 DriveDirectory* CreateDriveDirectory(); | 161 DriveDirectory* CreateDriveDirectory(); |
167 | 162 |
168 // Sets root directory resource id and initialize the root entry. | 163 // Sets root directory resource id and initialize the root entry. |
169 void InitializeRootEntry(const std::string& root_id); | 164 void InitializeRootEntry(const std::string& root_id); |
170 | 165 |
171 // Add |new entry| to |directory| and invoke the callback asynchronously. | 166 // Add |doc entry| to directory with path |directory_path| and invoke the |
| 167 // callback asynchronously. |
172 // |callback| may not be null. | 168 // |callback| may not be null. |
173 // TODO(achuith,satorux): Use DriveEntryProto instead for new_entry. | 169 void AddEntryToDirectory(const FilePath& directory_path, |
174 // crbug.com/142048 | 170 scoped_ptr<DocumentEntry> doc_entry, |
175 void AddEntryToDirectory(DriveDirectory* directory, | |
176 DriveEntry* new_entry, | |
177 const FileMoveCallback& callback); | 171 const FileMoveCallback& callback); |
178 | 172 |
179 // Moves |entry| to |directory_path| asynchronously. Removes entry from | 173 // Moves |entry| to |directory_path| asynchronously. Removes entry from |
180 // previous parent. Must be called on UI thread. |callback| is called on the | 174 // previous parent. Must be called on UI thread. |callback| is called on the |
181 // UI thread. |callback| may not be null. | 175 // UI thread. |callback| may not be null. |
182 void MoveEntryToDirectory(const FilePath& directory_path, | 176 void MoveEntryToDirectory(const FilePath& directory_path, |
183 DriveEntry* entry, | 177 DriveEntry* entry, |
184 const FileMoveCallback& callback); | 178 const FileMoveCallback& callback); |
185 | 179 |
186 // Removes entry with |resource_id| from its parent. Calls |callback| with the | 180 // Removes entry with |resource_id| from its parent. Calls |callback| with the |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // This should remain the last member so it'll be destroyed first and | 322 // This should remain the last member so it'll be destroyed first and |
329 // invalidate its weak pointers before other members are destroyed. | 323 // invalidate its weak pointers before other members are destroyed. |
330 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 324 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
331 | 325 |
332 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 326 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
333 }; | 327 }; |
334 | 328 |
335 } // namespace gdata | 329 } // namespace gdata |
336 | 330 |
337 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_RESOURCE_METADATA_H_ | 331 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_RESOURCE_METADATA_H_ |
OLD | NEW |