| 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" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 scoped_ptr<DriveEntryProto> entry_proto); | 79 scoped_ptr<DriveEntryProto> entry_proto); |
| 80 | 80 |
| 81 // Callback for handling resource rename attempt. Renames a file or | 81 // Callback for handling resource rename attempt. Renames a file or |
| 82 // directory at |file_path| on the client side. | 82 // directory at |file_path| on the client side. |
| 83 // |callback| must not be null. | 83 // |callback| must not be null. |
| 84 void RenameEntryLocally(const FilePath& file_path, | 84 void RenameEntryLocally(const FilePath& file_path, |
| 85 const FilePath::StringType& new_name, | 85 const FilePath::StringType& new_name, |
| 86 const FileMoveCallback& callback, | 86 const FileMoveCallback& callback, |
| 87 google_apis::GDataErrorCode status); | 87 google_apis::GDataErrorCode status); |
| 88 | 88 |
| 89 // Removes a file or directory at |file_path| from the current directory. | 89 // Removes a file or directory at |file_path| from the current directory if |
| 90 // It moves the entry to a dangle, no-parent state on the server side. | 90 // it's not in the root directory. This essentially moves an entry to the |
| 91 // root directory on the server side. |
| 91 // | 92 // |
| 92 // Can be called from UI thread. |callback| is run on the calling thread. | 93 // Can be called from UI thread. |callback| is run on the calling thread. |
| 93 // |callback| must not be null. | 94 // |callback| must not be null. |
| 94 void RemoveEntryFromDirectory(const FileMoveCallback& callback, | 95 void RemoveEntryFromNonRootDirectory(const FileMoveCallback& callback, |
| 95 DriveFileError error, | 96 DriveFileError error, |
| 96 const FilePath& file_path); | 97 const FilePath& file_path); |
| 97 | 98 |
| 98 // Part of RemoveEntryFromDirectory(). Called after | 99 // Part of RemoveEntryFromNonRootDirectory(). Called after |
| 99 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. | 100 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. |
| 100 void RemoveEntryFromDirectoryAfterEntryInfoPair( | 101 void RemoveEntryFromNonRootDirectoryAfterEntryInfoPair( |
| 101 const FileMoveCallback& callback, | 102 const FileMoveCallback& callback, |
| 102 scoped_ptr<EntryInfoPairResult> result); | 103 scoped_ptr<EntryInfoPairResult> result); |
| 103 | 104 |
| 104 // Moves a file or directory at |file_path| to another directory at | 105 // Moves a file or directory at |file_path| in the root directory to |
| 105 // |dir_path|. | 106 // another directory at |dir_path|. This function does nothing if |
| 107 // |dir_path| points to the root directory. |
| 106 // | 108 // |
| 107 // Can be called from UI thread. |callback| is run on the calling thread. | 109 // Can be called from UI thread. |callback| is run on the calling thread. |
| 108 // |callback| must not be null. | 110 // |callback| must not be null. |
| 109 void AddEntryToDirectory(const FilePath& directory_path, | 111 void MoveEntryFromRootDirectory(const FilePath& directory_path, |
| 110 const FileOperationCallback& callback, | 112 const FileOperationCallback& callback, |
| 111 DriveFileError error, | 113 DriveFileError error, |
| 112 const FilePath& file_path); | 114 const FilePath& file_path); |
| 113 | 115 |
| 114 // Part of AddEntryToDirectory(). Called after | 116 // Part of MoveEntryFromRootDirectory(). Called after |
| 115 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. | 117 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. |
| 116 void AddEntryToDirectoryAfterGetEntryInfoPair( | 118 void MoveEntryFromRootDirectoryAfterGetEntryInfoPair( |
| 117 const FileOperationCallback& callback, | 119 const FileOperationCallback& callback, |
| 118 scoped_ptr<EntryInfoPairResult> result); | 120 scoped_ptr<EntryInfoPairResult> result); |
| 119 | 121 |
| 120 // Moves entry specified by |file_path| to the directory specified by | 122 // Moves entry specified by |file_path| to the directory specified by |
| 121 // |dir_path| and calls |callback| asynchronously. | 123 // |dir_path| and calls |callback| asynchronously. |
| 122 // |callback| must not be null. | 124 // |callback| must not be null. |
| 123 void MoveEntryToDirectory(const FilePath& file_path, | 125 void MoveEntryToDirectory(const FilePath& file_path, |
| 124 const FilePath& directory_path, | 126 const FilePath& directory_path, |
| 125 const FileMoveCallback& callback, | 127 const FileMoveCallback& callback, |
| 126 google_apis::GDataErrorCode status); | 128 google_apis::GDataErrorCode status); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 150 // invalidate the weak pointers before any other members are destroyed. | 152 // invalidate the weak pointers before any other members are destroyed. |
| 151 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; | 153 base::WeakPtrFactory<MoveOperation> weak_ptr_factory_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(MoveOperation); | 155 DISALLOW_COPY_AND_ASSIGN(MoveOperation); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace file_system | 158 } // namespace file_system |
| 157 } // namespace drive | 159 } // namespace drive |
| 158 | 160 |
| 159 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ | 161 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_MOVE_OPERATION_H_ |
| OLD | NEW |