| 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_MOVE_OPERATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_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 FilePath; | 14 class FilePath; |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace gdata { | 17 namespace drive { |
| 18 | 18 |
| 19 class DriveCache; | 19 class DriveCache; |
| 20 class DriveEntryProto; | 20 class DriveEntryProto; |
| 21 class DriveFileSystem; | 21 class DriveFileSystem; |
| 22 class DriveServiceInterface; | 22 class DriveServiceInterface; |
| 23 | 23 |
| 24 namespace file_system { | 24 namespace file_system { |
| 25 | 25 |
| 26 // This class encapsulates the drive Move function. It is resposible for | 26 // This class encapsulates the drive Move function. It is resposible for |
| 27 // sending the request to the drive API, then updating the local state and | 27 // sending the request to the drive API, then updating the local state and |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const FileMoveCallback& callback, | 72 const FileMoveCallback& callback, |
| 73 DriveFileError error, | 73 DriveFileError error, |
| 74 scoped_ptr<DriveEntryProto> entry_proto); | 74 scoped_ptr<DriveEntryProto> entry_proto); |
| 75 | 75 |
| 76 // Callback for handling resource rename attempt. Renames a file or | 76 // Callback for handling resource rename attempt. Renames a file or |
| 77 // directory at |file_path| on the client side. | 77 // directory at |file_path| on the client side. |
| 78 // |callback| must not be null. | 78 // |callback| must not be null. |
| 79 void RenameEntryLocally(const FilePath& file_path, | 79 void RenameEntryLocally(const FilePath& file_path, |
| 80 const FilePath::StringType& new_name, | 80 const FilePath::StringType& new_name, |
| 81 const FileMoveCallback& callback, | 81 const FileMoveCallback& callback, |
| 82 GDataErrorCode status, | 82 gdata::GDataErrorCode status, |
| 83 const GURL& document_url); | 83 const GURL& document_url); |
| 84 | 84 |
| 85 // Removes a file or directory at |file_path| from the current directory if | 85 // Removes a file or directory at |file_path| from the current directory if |
| 86 // it's not in the root directory. This essentially moves an entry to the | 86 // it's not in the root directory. This essentially moves an entry to the |
| 87 // root directory on the server side. | 87 // root directory on the server side. |
| 88 // | 88 // |
| 89 // Can be called from UI thread. |callback| is run on the calling thread. | 89 // Can be called from UI thread. |callback| is run on the calling thread. |
| 90 // |callback| must not be null. | 90 // |callback| must not be null. |
| 91 void RemoveEntryFromNonRootDirectory(const FileMoveCallback& callback, | 91 void RemoveEntryFromNonRootDirectory(const FileMoveCallback& callback, |
| 92 DriveFileError error, | 92 DriveFileError error, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 114 void MoveEntryFromRootDirectoryAfterGetEntryInfoPair( | 114 void MoveEntryFromRootDirectoryAfterGetEntryInfoPair( |
| 115 const FileOperationCallback& callback, | 115 const FileOperationCallback& callback, |
| 116 scoped_ptr<EntryInfoPairResult> result); | 116 scoped_ptr<EntryInfoPairResult> result); |
| 117 | 117 |
| 118 // Moves entry specified by |file_path| to the directory specified by | 118 // Moves entry specified by |file_path| to the directory specified by |
| 119 // |dir_path| and calls |callback| asynchronously. | 119 // |dir_path| and calls |callback| asynchronously. |
| 120 // |callback| must not be null. | 120 // |callback| must not be null. |
| 121 void MoveEntryToDirectory(const FilePath& file_path, | 121 void MoveEntryToDirectory(const FilePath& file_path, |
| 122 const FilePath& directory_path, | 122 const FilePath& directory_path, |
| 123 const FileMoveCallback& callback, | 123 const FileMoveCallback& callback, |
| 124 GDataErrorCode status, | 124 gdata::GDataErrorCode status, |
| 125 const GURL& document_url); | 125 const GURL& document_url); |
| 126 | 126 |
| 127 // Callback when an entry is moved to another directory on the client side. | 127 // Callback when an entry is moved to another directory on the client side. |
| 128 // Notifies the directory change and runs |callback|. | 128 // Notifies the directory change and runs |callback|. |
| 129 // |callback| must not be null. | 129 // |callback| must not be null. |
| 130 void NotifyAndRunFileOperationCallback( | 130 void NotifyAndRunFileOperationCallback( |
| 131 const FileOperationCallback& callback, | 131 const FileOperationCallback& callback, |
| 132 DriveFileError error, | 132 DriveFileError error, |
| 133 const FilePath& moved_file_path); | 133 const FilePath& moved_file_path); |
| 134 | 134 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 146 | 146 |
| 147 // WeakPtrFactory bound to the UI thread. | 147 // WeakPtrFactory bound to the UI thread. |
| 148 // Note: This should remain the last member so it'll be destroyed and | 148 // Note: This should remain the last member so it'll be destroyed and |
| 149 // invalidate the weak pointers before any other members are destroyed. | 149 // invalidate the weak pointers before any other members are destroyed. |
| 150 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; | 150 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(MoveOperation); | 152 DISALLOW_COPY_AND_ASSIGN(MoveOperation); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace file_system | 155 } // namespace file_system |
| 156 } // namespace gdata | 156 } // namespace drive |
| 157 | 157 |
| 158 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 158 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
| OLD | NEW |