| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" | 5 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" | 10 #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h
" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 base::Unretained(impl_.get()), | 111 base::Unretained(impl_.get()), |
| 112 url, exclusive, recursive, | 112 url, exclusive, recursive, |
| 113 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); | 113 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); |
| 114 operation_runner_->PostOperationTask(task.Pass()); | 114 operation_runner_->PostOperationTask(task.Pass()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SyncableFileSystemOperation::Copy( | 117 void SyncableFileSystemOperation::Copy( |
| 118 const FileSystemURL& src_url, | 118 const FileSystemURL& src_url, |
| 119 const FileSystemURL& dest_url, | 119 const FileSystemURL& dest_url, |
| 120 CopyOrMoveOption option, | 120 CopyOrMoveOption option, |
| 121 const bool continue_with_error, |
| 122 const CopyOrMoveErrorCallback& error_callback, |
| 121 const CopyProgressCallback& progress_callback, | 123 const CopyProgressCallback& progress_callback, |
| 122 const StatusCallback& callback) { | 124 const StatusCallback& callback) { |
| 123 DCHECK(CalledOnValidThread()); | 125 DCHECK(CalledOnValidThread()); |
| 124 if (!operation_runner_.get()) { | 126 if (!operation_runner_.get()) { |
| 125 callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 127 callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
| 126 return; | 128 return; |
| 127 } | 129 } |
| 128 DCHECK(operation_runner_.get()); | 130 DCHECK(operation_runner_.get()); |
| 129 target_paths_.push_back(dest_url); | 131 target_paths_.push_back(dest_url); |
| 130 completion_callback_ = callback; | 132 completion_callback_ = callback; |
| 131 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( | 133 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( |
| 132 weak_factory_.GetWeakPtr(), | 134 weak_factory_.GetWeakPtr(), |
| 133 base::Bind(&FileSystemOperation::Copy, | 135 base::Bind(&FileSystemOperation::Copy, base::Unretained(impl_.get()), |
| 134 base::Unretained(impl_.get()), | 136 src_url, dest_url, option, continue_with_error, error_callback, |
| 135 src_url, dest_url, option, progress_callback, | 137 progress_callback, |
| 136 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); | 138 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); |
| 137 operation_runner_->PostOperationTask(task.Pass()); | 139 operation_runner_->PostOperationTask(task.Pass()); |
| 138 } | 140 } |
| 139 | 141 |
| 140 void SyncableFileSystemOperation::Move( | 142 void SyncableFileSystemOperation::Move( |
| 141 const FileSystemURL& src_url, | 143 const FileSystemURL& src_url, |
| 142 const FileSystemURL& dest_url, | 144 const FileSystemURL& dest_url, |
| 143 CopyOrMoveOption option, | 145 CopyOrMoveOption option, |
| 144 const StatusCallback& callback) { | 146 const StatusCallback& callback) { |
| 145 DCHECK(CalledOnValidThread()); | 147 DCHECK(CalledOnValidThread()); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 operation_runner_->OnOperationCompleted(target_paths_); | 389 operation_runner_->OnOperationCompleted(target_paths_); |
| 388 callback.Run(result, bytes, complete); | 390 callback.Run(result, bytes, complete); |
| 389 } | 391 } |
| 390 | 392 |
| 391 void SyncableFileSystemOperation::OnCancelled() { | 393 void SyncableFileSystemOperation::OnCancelled() { |
| 392 DCHECK(!completion_callback_.is_null()); | 394 DCHECK(!completion_callback_.is_null()); |
| 393 completion_callback_.Run(base::File::FILE_ERROR_ABORT); | 395 completion_callback_.Run(base::File::FILE_ERROR_ABORT); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace sync_file_system | 398 } // namespace sync_file_system |
| OLD | NEW |