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