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

Side by Side Diff: webkit/browser/fileapi/copy_or_move_operation_delegate.cc

Issue 24030002: Adds callbacks to notify progress into Copy's API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" 5 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "webkit/browser/fileapi/copy_or_move_file_validator.h" 9 #include "webkit/browser/fileapi/copy_or_move_file_validator.h"
10 #include "webkit/browser/fileapi/file_system_context.h" 10 #include "webkit/browser/fileapi/file_system_context.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 void CopyOrMoveOperationDelegate::CopyOrMoveFile( 119 void CopyOrMoveOperationDelegate::CopyOrMoveFile(
120 const URLPair& url_pair, 120 const URLPair& url_pair,
121 const StatusCallback& callback) { 121 const StatusCallback& callback) {
122 // Same filesystem case. 122 // Same filesystem case.
123 if (same_file_system_) { 123 if (same_file_system_) {
124 if (operation_type_ == OPERATION_MOVE) { 124 if (operation_type_ == OPERATION_MOVE) {
125 operation_runner()->MoveFileLocal(url_pair.src, url_pair.dest, callback); 125 operation_runner()->MoveFileLocal(url_pair.src, url_pair.dest, callback);
126 } else { 126 } else {
127 operation_runner()->CopyFileLocal(url_pair.src, url_pair.dest, callback); 127 // TODO(hidehiko): Support progress callback.
128 operation_runner()->CopyFileLocal(
129 url_pair.src, url_pair.dest,
130 FileSystemOperationRunner::CopyFileProgressCallback(), callback);
128 } 131 }
129 return; 132 return;
130 } 133 }
131 134
132 // Cross filesystem case. 135 // Cross filesystem case.
133 // Perform CreateSnapshotFile, CopyInForeignFile and then calls 136 // Perform CreateSnapshotFile, CopyInForeignFile and then calls
134 // copy_callback which removes the source file if operation_type == MOVE. 137 // copy_callback which removes the source file if operation_type == MOVE.
135 StatusCallback copy_callback = 138 StatusCallback copy_callback =
136 base::Bind(&CopyOrMoveOperationDelegate::DidFinishCopy, 139 base::Bind(&CopyOrMoveOperationDelegate::DidFinishCopy,
137 weak_factory_.GetWeakPtr(), url_pair, callback); 140 weak_factory_.GetWeakPtr(), url_pair, callback);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 const StatusCallback& callback, 319 const StatusCallback& callback,
317 base::PlatformFileError error) { 320 base::PlatformFileError error) {
318 if (error != base::PLATFORM_FILE_OK) { 321 if (error != base::PLATFORM_FILE_OK) {
319 VLOG(1) << "Error removing destination file after validation error: " 322 VLOG(1) << "Error removing destination file after validation error: "
320 << error; 323 << error;
321 } 324 }
322 callback.Run(prior_error); 325 callback.Run(prior_error);
323 } 326 }
324 327
325 } // namespace fileapi 328 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/async_file_test_helper.cc ('k') | webkit/browser/fileapi/file_system_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698