| 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_FILE_SYSTEM_UPDATE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 11 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
| 12 #include "chrome/browser/google_apis/gdata_errorcode.h" | 12 #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 13 | 13 |
| 14 class GURL; |
| 15 |
| 16 namespace base { |
| 14 class FilePath; | 17 class FilePath; |
| 15 class GURL; | 18 } |
| 16 | 19 |
| 17 namespace google_apis { | 20 namespace google_apis { |
| 18 class DriveUploaderInterface; | 21 class DriveUploaderInterface; |
| 19 } | 22 } |
| 20 | 23 |
| 21 namespace drive { | 24 namespace drive { |
| 22 | 25 |
| 23 class DriveCache; | 26 class DriveCache; |
| 24 class DriveEntryProto; | 27 class DriveEntryProto; |
| 25 | 28 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 const std::string& resource_id, | 54 const std::string& resource_id, |
| 52 const FileOperationCallback& callback); | 55 const FileOperationCallback& callback); |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 // Part of UpdateFileByResourceId(). Called when | 58 // Part of UpdateFileByResourceId(). Called when |
| 56 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. | 59 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. |
| 57 // |callback| must not be null. | 60 // |callback| must not be null. |
| 58 void UpdateFileByEntryInfo( | 61 void UpdateFileByEntryInfo( |
| 59 const FileOperationCallback& callback, | 62 const FileOperationCallback& callback, |
| 60 DriveFileError error, | 63 DriveFileError error, |
| 61 const FilePath& drive_file_path, | 64 const base::FilePath& drive_file_path, |
| 62 scoped_ptr<DriveEntryProto> entry_proto); | 65 scoped_ptr<DriveEntryProto> entry_proto); |
| 63 | 66 |
| 64 // Part of UpdateFileByResourceId(). | 67 // Part of UpdateFileByResourceId(). |
| 65 // Called when DriveCache::GetFileOnUIThread() is completed for | 68 // Called when DriveCache::GetFileOnUIThread() is completed for |
| 66 // UpdateFileByResourceId(). | 69 // UpdateFileByResourceId(). |
| 67 // |callback| must not be null. | 70 // |callback| must not be null. |
| 68 void OnGetFileCompleteForUpdateFile(const FileOperationCallback& callback, | 71 void OnGetFileCompleteForUpdateFile(const FileOperationCallback& callback, |
| 69 const FilePath& drive_file_path, | 72 const base::FilePath& drive_file_path, |
| 70 scoped_ptr<DriveEntryProto> entry_proto, | 73 scoped_ptr<DriveEntryProto> entry_proto, |
| 71 DriveFileError error, | 74 DriveFileError error, |
| 72 const FilePath& cache_file_path); | 75 const base::FilePath& cache_file_path); |
| 73 | 76 |
| 74 // Part of UpdateFileByResourceId(). | 77 // Part of UpdateFileByResourceId(). |
| 75 // Called when DriveUploader::UploadUpdatedFile() is completed for | 78 // Called when DriveUploader::UploadUpdatedFile() is completed for |
| 76 // UpdateFileByResourceId(). | 79 // UpdateFileByResourceId(). |
| 77 // |callback| must not be null. | 80 // |callback| must not be null. |
| 78 void OnUpdatedFileUploaded( | 81 void OnUpdatedFileUploaded( |
| 79 const FileOperationCallback& callback, | 82 const FileOperationCallback& callback, |
| 80 google_apis::DriveUploadError error, | 83 google_apis::DriveUploadError error, |
| 81 const FilePath& gdata_path, | 84 const base::FilePath& gdata_path, |
| 82 const FilePath& file_path, | 85 const base::FilePath& file_path, |
| 83 scoped_ptr<google_apis::ResourceEntry> resource_entry); | 86 scoped_ptr<google_apis::ResourceEntry> resource_entry); |
| 84 | 87 |
| 85 // Part of UpdateFileByResourceId(). | 88 // Part of UpdateFileByResourceId(). |
| 86 // |callback| must not be null. | 89 // |callback| must not be null. |
| 87 void OnUpdatedFileRefreshed(const FileOperationCallback& callback, | 90 void OnUpdatedFileRefreshed(const FileOperationCallback& callback, |
| 88 DriveFileError error, | 91 DriveFileError error, |
| 89 const FilePath& drive_file_path, | 92 const base::FilePath& drive_file_path, |
| 90 scoped_ptr<DriveEntryProto> entry_proto); | 93 scoped_ptr<DriveEntryProto> entry_proto); |
| 91 | 94 |
| 92 DriveCache* cache_; | 95 DriveCache* cache_; |
| 93 DriveResourceMetadata* metadata_; | 96 DriveResourceMetadata* metadata_; |
| 94 google_apis::DriveUploaderInterface* uploader_; | 97 google_apis::DriveUploaderInterface* uploader_; |
| 95 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 98 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 96 OperationObserver* observer_; | 99 OperationObserver* observer_; |
| 97 | 100 |
| 98 // WeakPtrFactory bound to the UI thread. | 101 // WeakPtrFactory bound to the UI thread. |
| 99 // Note: This should remain the last member so it'll be destroyed and | 102 // Note: This should remain the last member so it'll be destroyed and |
| 100 // invalidate the weak pointers before any other members are destroyed. | 103 // invalidate the weak pointers before any other members are destroyed. |
| 101 base::WeakPtrFactory<UpdateOperation> weak_ptr_factory_; | 104 base::WeakPtrFactory<UpdateOperation> weak_ptr_factory_; |
| 102 | 105 |
| 103 DISALLOW_COPY_AND_ASSIGN(UpdateOperation); | 106 DISALLOW_COPY_AND_ASSIGN(UpdateOperation); |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 } // namespace file_system | 109 } // namespace file_system |
| 107 } // namespace drive | 110 } // namespace drive |
| 108 | 111 |
| 109 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ | 112 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UPDATE_OPERATION_H_ |
| OLD | NEW |