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_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 const FilePath::StringType& new_name, | 366 const FilePath::StringType& new_name, |
367 const FileMoveCallback& callback); | 367 const FileMoveCallback& callback); |
368 | 368 |
369 // Part of Rename(). Called after GetEntryInfoByPath() is complete. | 369 // Part of Rename(). Called after GetEntryInfoByPath() is complete. |
370 void RenameAfterGetEntryInfo(const FilePath& file_path, | 370 void RenameAfterGetEntryInfo(const FilePath& file_path, |
371 const FilePath::StringType& new_name, | 371 const FilePath::StringType& new_name, |
372 const FileMoveCallback& callback, | 372 const FileMoveCallback& callback, |
373 GDataFileError error, | 373 GDataFileError error, |
374 scoped_ptr<GDataEntryProto> entry_proto); | 374 scoped_ptr<GDataEntryProto> entry_proto); |
375 | 375 |
376 // Adds a file or directory at |file_path| to the directory at |dir_path|. | 376 // Moves a file or directory at |file_path| in the root directory to |
| 377 // another directory at |dir_path|. This function does nothing if |
| 378 // |dir_path| points to the root directory. |
377 // | 379 // |
378 // Can be called from UI thread. |callback| is run on the calling thread. | 380 // Can be called from UI thread. |callback| is run on the calling thread. |
379 void AddEntryToDirectory(const FilePath& dir_path, | 381 // |callback| must not be null. |
380 const FileOperationCallback& callback, | 382 void MoveEntryFromRootDirectory(const FilePath& dir_path, |
381 GDataFileError error, | 383 const FileOperationCallback& callback, |
382 const FilePath& file_path); | 384 GDataFileError error, |
| 385 const FilePath& file_path); |
383 | 386 |
384 // Removes a file or directory at |file_path| from the directory at | 387 // Removes a file or directory at |file_path| from the directory at |
385 // |dir_path| and moves it to the root directory. | 388 // |dir_path| and moves it to the root directory. |
386 // | 389 // |
387 // Can be called from UI thread. |callback| is run on the calling thread. | 390 // Can be called from UI thread. |callback| is run on the calling thread. |
388 void RemoveEntryFromDirectory(const FilePath& dir_path, | 391 void RemoveEntryFromDirectory(const FilePath& dir_path, |
389 const FileMoveCallback& callback, | 392 const FileMoveCallback& callback, |
390 GDataFileError error, | 393 GDataFileError error, |
391 const FilePath& file_path); | 394 const FilePath& file_path); |
392 | 395 |
(...skipping 22 matching lines...) Expand all Loading... |
415 const std::string& md5, | 418 const std::string& md5, |
416 const FilePath& cache_file_path); | 419 const FilePath& cache_file_path); |
417 | 420 |
418 // Callback for handling document copy attempt. | 421 // Callback for handling document copy attempt. |
419 // |callback| must not be null. | 422 // |callback| must not be null. |
420 void OnCopyDocumentCompleted(const FilePath& dir_path, | 423 void OnCopyDocumentCompleted(const FilePath& dir_path, |
421 const FileOperationCallback& callback, | 424 const FileOperationCallback& callback, |
422 GDataErrorCode status, | 425 GDataErrorCode status, |
423 scoped_ptr<base::Value> data); | 426 scoped_ptr<base::Value> data); |
424 | 427 |
425 // Callback for handling an attempt to add a file or directory to another | 428 // Callback for handling an attempt to move a file or directory from the |
426 // directory. | 429 // root directory to another directory on the server side. This function |
427 void OnAddEntryToDirectoryCompleted(const FileOperationCallback& callback, | 430 // moves |entry| to the root directory on the client side with |
428 const FilePath& file_path, | 431 // GDataDirectoryService::MoveEntryToDirectory(). |
429 const FilePath& dir_path, | 432 // |
430 GDataErrorCode status, | 433 // |callback| must not be null. |
431 const GURL& document_url); | 434 void OnMoveEntryFromRootDirectoryCompleted( |
| 435 const FileOperationCallback& callback, |
| 436 const FilePath& file_path, |
| 437 const FilePath& dir_path, |
| 438 GDataErrorCode status, |
| 439 const GURL& document_url); |
432 | 440 |
433 // Callback for handling account metadata fetch. | 441 // Callback for handling account metadata fetch. |
434 void OnGetAvailableSpace( | 442 void OnGetAvailableSpace( |
435 const GetAvailableSpaceCallback& callback, | 443 const GetAvailableSpaceCallback& callback, |
436 GDataErrorCode status, | 444 GDataErrorCode status, |
437 scoped_ptr<base::Value> data); | 445 scoped_ptr<base::Value> data); |
438 | 446 |
439 // Callback for handling Drive V2 about resource fetch. | 447 // Callback for handling Drive V2 about resource fetch. |
440 void OnGetAboutResource( | 448 void OnGetAboutResource( |
441 const GetAvailableSpaceCallback& callback, | 449 const GetAvailableSpaceCallback& callback, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 516 |
509 // Callback for GDataDirectoryService::MoveEntryToDirectory with | 517 // Callback for GDataDirectoryService::MoveEntryToDirectory with |
510 // FileMoveCallback. | 518 // FileMoveCallback. |
511 void OnMoveEntryToDirectoryWithFileMoveCallback( | 519 void OnMoveEntryToDirectoryWithFileMoveCallback( |
512 const FileMoveCallback& callback, | 520 const FileMoveCallback& callback, |
513 GDataFileError error, | 521 GDataFileError error, |
514 const FilePath& moved_file_path); | 522 const FilePath& moved_file_path); |
515 | 523 |
516 // Callback for GDataDirectoryService::MoveEntryToDirectory with | 524 // Callback for GDataDirectoryService::MoveEntryToDirectory with |
517 // FileOperationCallback. | 525 // FileOperationCallback. |
| 526 // |callback| must not be null. |
518 void OnMoveEntryToDirectoryWithFileOperationCallback( | 527 void OnMoveEntryToDirectoryWithFileOperationCallback( |
519 const FileOperationCallback& callback, | 528 const FileOperationCallback& callback, |
520 GDataFileError error, | 529 GDataFileError error, |
521 const FilePath& moved_file_path); | 530 const FilePath& moved_file_path); |
522 | 531 |
523 // Callback for GetEntryByResourceIdAsync. | 532 // Callback for GetEntryByResourceIdAsync. |
524 // Removes stale entry upon upload of file. | 533 // Removes stale entry upon upload of file. |
525 static void RemoveStaleEntryOnUpload(const std::string& resource_id, | 534 static void RemoveStaleEntryOnUpload(const std::string& resource_id, |
526 GDataDirectory* parent_dir, | 535 GDataDirectory* parent_dir, |
527 GDataEntry* existing_entry); | 536 GDataEntry* existing_entry); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 // invalidate the weak pointers before any other members are destroyed. | 849 // invalidate the weak pointers before any other members are destroyed. |
841 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 850 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
842 // Unlike other classes, we need this as we need this to redirect a task | 851 // Unlike other classes, we need this as we need this to redirect a task |
843 // from IO thread to UI thread. | 852 // from IO thread to UI thread. |
844 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 853 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
845 }; | 854 }; |
846 | 855 |
847 } // namespace gdata | 856 } // namespace gdata |
848 | 857 |
849 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 858 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |