OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 BASE_FILE_UTIL_PROXY_H_ | 5 #ifndef BASE_FILE_UTIL_PROXY_H_ |
6 #define BASE_FILE_UTIL_PROXY_H_ | 6 #define BASE_FILE_UTIL_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 >::Type ReadDirectoryCallback; | 82 >::Type ReadDirectoryCallback; |
83 static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 83 static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
84 const FilePath& file_path, | 84 const FilePath& file_path, |
85 ReadDirectoryCallback* callback); | 85 ReadDirectoryCallback* callback); |
86 | 86 |
87 // Copies a file or a directory from |src_file_path| to |dest_file_path| | 87 // Copies a file or a directory from |src_file_path| to |dest_file_path| |
88 // Error cases: | 88 // Error cases: |
89 // If destination file doesn't exist or destination's parent | 89 // If destination file doesn't exist or destination's parent |
90 // doesn't exists. | 90 // doesn't exists. |
91 // If source dir exists but destination path is an existing file. | 91 // If source dir exists but destination path is an existing file. |
| 92 // If source file exists but destination path is an existing directory. |
92 // If source is a parent of destination. | 93 // If source is a parent of destination. |
93 // If source doesn't exists. | 94 // If source doesn't exists. |
94 static bool Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 95 static bool Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
95 const FilePath& src_file_path, | 96 const FilePath& src_file_path, |
96 const FilePath& dest_file_path, | 97 const FilePath& dest_file_path, |
97 StatusCallback* callback); | 98 StatusCallback* callback); |
98 | 99 |
99 // Creates directory at given path. It's an error to create | 100 // Creates directory at given path. It's an error to create |
100 // if |exclusive| is true and dir already exists. | 101 // if |exclusive| is true and dir already exists. |
101 static bool CreateDirectory( | 102 static bool CreateDirectory( |
102 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 103 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
103 const FilePath& file_path, | 104 const FilePath& file_path, |
104 bool exclusive, | 105 bool exclusive, |
105 bool recursive, | 106 bool recursive, |
106 StatusCallback* callback); | 107 StatusCallback* callback); |
107 | 108 |
108 // Deletes a file or empty directory. | 109 // Deletes a file or a directory. |
| 110 // It is an error to delete a non-empty directory with recursive=false. |
109 static bool Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 111 static bool Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
110 const FilePath& file_path, | 112 const FilePath& file_path, |
| 113 bool recursive, |
111 StatusCallback* callback); | 114 StatusCallback* callback); |
112 | 115 |
113 // Moves a file or a directory from src_file_path to dest_file_path. | 116 // Moves a file or a directory from src_file_path to dest_file_path. |
114 // Error cases are similar to Copy method's error cases. | 117 // Error cases are similar to Copy method's error cases. |
115 static bool Move( | 118 static bool Move( |
116 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 119 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
117 const FilePath& src_file_path, | 120 const FilePath& src_file_path, |
118 const FilePath& dest_file_path, | 121 const FilePath& dest_file_path, |
119 StatusCallback* callback); | 122 StatusCallback* callback); |
120 | 123 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 base::PlatformFile file, | 181 base::PlatformFile file, |
179 StatusCallback* callback); | 182 StatusCallback* callback); |
180 | 183 |
181 private: | 184 private: |
182 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); | 185 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
183 }; | 186 }; |
184 | 187 |
185 } // namespace base | 188 } // namespace base |
186 | 189 |
187 #endif // BASE_FILE_UTIL_PROXY_H_ | 190 #endif // BASE_FILE_UTIL_PROXY_H_ |
OLD | NEW |