OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |