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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Iterates over entries and runs |iterate_callback| for each entry with | 227 // Iterates over entries and runs |iterate_callback| for each entry with |
228 // |blocking_task_runner_|. Runs |completion_callback| after iterating over | 228 // |blocking_task_runner_|. Runs |completion_callback| after iterating over |
229 // all entries. | 229 // all entries. |
230 void IterateEntries(const IterateCallback& iterate_callback, | 230 void IterateEntries(const IterateCallback& iterate_callback, |
231 const base::Closure& completion_callback); | 231 const base::Closure& completion_callback); |
232 | 232 |
233 private: | 233 private: |
234 struct FileMoveResult; | 234 struct FileMoveResult; |
235 struct GetEntryInfoResult; | 235 struct GetEntryInfoResult; |
236 struct GetEntryInfoWithFilePathResult; | |
237 struct ReadDirectoryResult; | 236 struct ReadDirectoryResult; |
238 | 237 |
239 // Note: Use Destroy() to delete this object. | 238 // Note: Use Destroy() to delete this object. |
240 virtual ~DriveResourceMetadata(); | 239 virtual ~DriveResourceMetadata(); |
241 | 240 |
242 // Used to implement Initialize(); | 241 // Used to implement Initialize(); |
243 FileError InitializeOnBlockingPool() WARN_UNUSED_RESULT; | 242 FileError InitializeOnBlockingPool() WARN_UNUSED_RESULT; |
244 | 243 |
245 // Sets up entries which should be present by default. | 244 // Sets up entries which should be present by default. |
246 void SetUpDefaultEntries(); | 245 void SetUpDefaultEntries(); |
(...skipping 19 matching lines...) Expand all Loading... |
266 const base::FilePath& directory_path); | 265 const base::FilePath& directory_path); |
267 | 266 |
268 // Used to implement RenameEntry(). | 267 // Used to implement RenameEntry(). |
269 FileMoveResult RenameEntryOnBlockingPool(const base::FilePath& file_path, | 268 FileMoveResult RenameEntryOnBlockingPool(const base::FilePath& file_path, |
270 const std::string& new_name); | 269 const std::string& new_name); |
271 | 270 |
272 // Used to implement RemoveEntry(). | 271 // Used to implement RemoveEntry(). |
273 FileMoveResult RemoveEntryOnBlockingPool(const std::string& resource_id); | 272 FileMoveResult RemoveEntryOnBlockingPool(const std::string& resource_id); |
274 | 273 |
275 // Used to implement GetEntryInfoByResourceId(). | 274 // Used to implement GetEntryInfoByResourceId(). |
276 scoped_ptr<GetEntryInfoWithFilePathResult> | 275 FileError GetEntryInfoByResourceIdOnBlockingPool( |
277 GetEntryInfoByResourceIdOnBlockingPool(const std::string& resource_id); | 276 const std::string& resource_id, |
| 277 base::FilePath* out_file_path, |
| 278 DriveEntryProto* out_entry); |
278 | 279 |
279 // Used to implement GetEntryInfoByPath(). | 280 // Used to implement GetEntryInfoByPath(). |
280 scoped_ptr<GetEntryInfoResult> GetEntryInfoByPathOnBlockingPool( | 281 scoped_ptr<GetEntryInfoResult> GetEntryInfoByPathOnBlockingPool( |
281 const base::FilePath& file_path); | 282 const base::FilePath& file_path); |
282 | 283 |
283 // Used to implement ReadDirectoryByPath(). | 284 // Used to implement ReadDirectoryByPath(). |
284 scoped_ptr<ReadDirectoryResult> ReadDirectoryByPathOnBlockingPool( | 285 scoped_ptr<ReadDirectoryResult> ReadDirectoryByPathOnBlockingPool( |
285 const base::FilePath& file_path); | 286 const base::FilePath& file_path); |
286 | 287 |
287 // Used to implement RefreshEntry(). | 288 // Used to implement RefreshEntry(). |
288 scoped_ptr<GetEntryInfoWithFilePathResult> RefreshEntryOnBlockingPool( | 289 FileError RefreshEntryOnBlockingPool(const DriveEntryProto& entry_proto, |
289 const DriveEntryProto& entry_proto); | 290 base::FilePath* out_file_path, |
| 291 DriveEntryProto* out_entry); |
290 | 292 |
291 // Used to implement RefreshDirectory(). | 293 // Used to implement RefreshDirectory(). |
292 FileMoveResult RefreshDirectoryOnBlockingPool( | 294 FileMoveResult RefreshDirectoryOnBlockingPool( |
293 const DirectoryFetchInfo& directory_fetch_info, | 295 const DirectoryFetchInfo& directory_fetch_info, |
294 const DriveEntryProtoMap& entry_proto_map); | 296 const DriveEntryProtoMap& entry_proto_map); |
295 | 297 |
296 // Used to implement GetChildDirectories(). | 298 // Used to implement GetChildDirectories(). |
297 scoped_ptr<std::set<base::FilePath> > GetChildDirectoriesOnBlockingPool( | 299 scoped_ptr<std::set<base::FilePath> > GetChildDirectoriesOnBlockingPool( |
298 const std::string& resource_id); | 300 const std::string& resource_id); |
299 | 301 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // This should remain the last member so it'll be destroyed first and | 368 // This should remain the last member so it'll be destroyed first and |
367 // invalidate its weak pointers before other members are destroyed. | 369 // invalidate its weak pointers before other members are destroyed. |
368 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; | 370 base::WeakPtrFactory<DriveResourceMetadata> weak_ptr_factory_; |
369 | 371 |
370 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); | 372 DISALLOW_COPY_AND_ASSIGN(DriveResourceMetadata); |
371 }; | 373 }; |
372 | 374 |
373 } // namespace drive | 375 } // namespace drive |
374 | 376 |
375 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ | 377 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
OLD | NEW |