Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Side by Side Diff: webkit/fileapi/file_system_file_util.h

Issue 7066033: Enable cross-filesystem moves and copies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Readability tweak from Michael Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/fileapi/file_system_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 bool exclusive, 109 bool exclusive,
110 bool recursive); 110 bool recursive);
111 111
112 // Copies or moves a single file. 112 // Copies or moves a single file.
113 virtual PlatformFileError CopyOrMoveFile( 113 virtual PlatformFileError CopyOrMoveFile(
114 FileSystemOperationContext* context, 114 FileSystemOperationContext* context,
115 const FilePath& src_file_path, 115 const FilePath& src_file_path,
116 const FilePath& dest_file_path, 116 const FilePath& dest_file_path,
117 bool copy); 117 bool copy);
118 118
119 // Copies in a single file from a different filesystem. The src_file_path is
120 // a true local platform path, regardless of which subclass of
121 // FileSystemFileUtil is being invoked.
122 virtual PlatformFileError CopyInForeignFile(
123 FileSystemOperationContext* context,
124 const FilePath& src_file_path,
125 const FilePath& dest_file_path);
126
119 // Copies a file or a directory from |src_file_path| to |dest_file_path|. 127 // Copies a file or a directory from |src_file_path| to |dest_file_path|.
120 // 128 //
121 // Error cases: 129 // Error cases:
122 // If destination's parent doesn't exist. 130 // If destination's parent doesn't exist.
123 // If source dir exists but destination path is an existing file. 131 // If source dir exists but destination path is an existing file.
124 // If source file exists but destination path is an existing directory. 132 // If source file exists but destination path is an existing directory.
125 // If source is a parent of destination. 133 // If source is a parent of destination.
126 // If source doesn't exist. 134 // If source doesn't exist.
127 // 135 //
128 // This method calls one of the following methods depending on whether the 136 // This method calls one of the following methods depending on whether the
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Performs recursive copy or move by calling CopyOrMoveFile for individual 255 // Performs recursive copy or move by calling CopyOrMoveFile for individual
248 // files. Operations for recursive traversal are encapsulated in this method. 256 // files. Operations for recursive traversal are encapsulated in this method.
249 // It assumes src_file_path and dest_file_path have passed 257 // It assumes src_file_path and dest_file_path have passed
250 // PerformCommonCheckAndPreparationForMoveAndCopy(). 258 // PerformCommonCheckAndPreparationForMoveAndCopy().
251 PlatformFileError CopyOrMoveDirectory( 259 PlatformFileError CopyOrMoveDirectory(
252 FileSystemOperationContext* context, 260 FileSystemOperationContext* context,
253 const FilePath& src_file_path, 261 const FilePath& src_file_path,
254 const FilePath& dest_file_path, 262 const FilePath& dest_file_path,
255 bool copy); 263 bool copy);
256 264
265 // Determines whether a simple same-filesystem move or copy can be done. If
266 // so, it delegates to CopyOrMoveFile. Otherwise it looks up the true
267 // platform path of the source file, delegates to CopyInForeignFile, and [for
268 // move] calls DeleteFile on the source file.
269 PlatformFileError CopyOrMoveFileHelper(
270 FileSystemOperationContext* context,
271 const FilePath& src_file_path,
272 const FilePath& dest_file_path,
273 bool copy);
274
257 // Returns a pointer to a new instance of AbstractFileEnumerator which is 275 // Returns a pointer to a new instance of AbstractFileEnumerator which is
258 // implemented for each FileUtil subclass. The instance needs to be freed 276 // implemented for each FileUtil subclass. The instance needs to be freed
259 // by the caller, and its lifetime should not extend past when the current 277 // by the caller, and its lifetime should not extend past when the current
260 // call returns to the main FILE message loop. 278 // call returns to the main FILE message loop.
261 virtual AbstractFileEnumerator* CreateFileEnumerator( 279 virtual AbstractFileEnumerator* CreateFileEnumerator(
262 FileSystemOperationContext* unused, 280 FileSystemOperationContext* unused,
263 const FilePath& root_path); 281 const FilePath& root_path);
264 282
265 friend struct DefaultSingletonTraits<FileSystemFileUtil>; 283 friend struct DefaultSingletonTraits<FileSystemFileUtil>;
266 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); 284 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil);
267 }; 285 };
268 286
269 } // namespace fileapi 287 } // namespace fileapi
270 288
271 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 289 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_system_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698