| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 base::Bind(&FileSystemOperation::CreateDirectory, | 117 base::Bind(&FileSystemOperation::CreateDirectory, |
| 118 base::Unretained(impl_.get()), | 118 base::Unretained(impl_.get()), |
| 119 url, exclusive, recursive, | 119 url, exclusive, recursive, |
| 120 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); | 120 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); |
| 121 operation_runner_->PostOperationTask(task.Pass()); | 121 operation_runner_->PostOperationTask(task.Pass()); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SyncableFileSystemOperation::Copy( | 124 void SyncableFileSystemOperation::Copy( |
| 125 const FileSystemURL& src_url, | 125 const FileSystemURL& src_url, |
| 126 const FileSystemURL& dest_url, | 126 const FileSystemURL& dest_url, |
| 127 const CopyProgressCallback& progress_callback, |
| 127 const StatusCallback& callback) { | 128 const StatusCallback& callback) { |
| 128 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
| 129 if (!operation_runner_.get()) { | 130 if (!operation_runner_.get()) { |
| 130 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND); | 131 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND); |
| 131 return; | 132 return; |
| 132 } | 133 } |
| 133 DCHECK(operation_runner_.get()); | 134 DCHECK(operation_runner_.get()); |
| 134 target_paths_.push_back(dest_url); | 135 target_paths_.push_back(dest_url); |
| 135 completion_callback_ = callback; | 136 completion_callback_ = callback; |
| 136 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( | 137 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( |
| 137 weak_factory_.GetWeakPtr(), | 138 weak_factory_.GetWeakPtr(), |
| 138 base::Bind(&FileSystemOperation::Copy, | 139 base::Bind(&FileSystemOperation::Copy, |
| 139 base::Unretained(impl_.get()), | 140 base::Unretained(impl_.get()), |
| 140 src_url, dest_url, | 141 src_url, dest_url, progress_callback, |
| 141 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); | 142 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); |
| 142 operation_runner_->PostOperationTask(task.Pass()); | 143 operation_runner_->PostOperationTask(task.Pass()); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void SyncableFileSystemOperation::Move( | 146 void SyncableFileSystemOperation::Move( |
| 146 const FileSystemURL& src_url, | 147 const FileSystemURL& src_url, |
| 147 const FileSystemURL& dest_url, | 148 const FileSystemURL& dest_url, |
| 148 const StatusCallback& callback) { | 149 const StatusCallback& callback) { |
| 149 DCHECK(CalledOnValidThread()); | 150 DCHECK(CalledOnValidThread()); |
| 150 if (!operation_runner_.get()) { | 151 if (!operation_runner_.get()) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void SyncableFileSystemOperation::RemoveDirectory( | 322 void SyncableFileSystemOperation::RemoveDirectory( |
| 322 const FileSystemURL& url, | 323 const FileSystemURL& url, |
| 323 const StatusCallback& callback) { | 324 const StatusCallback& callback) { |
| 324 DCHECK(CalledOnValidThread()); | 325 DCHECK(CalledOnValidThread()); |
| 325 impl_->RemoveDirectory(url, callback); | 326 impl_->RemoveDirectory(url, callback); |
| 326 } | 327 } |
| 327 | 328 |
| 328 void SyncableFileSystemOperation::CopyFileLocal( | 329 void SyncableFileSystemOperation::CopyFileLocal( |
| 329 const FileSystemURL& src_url, | 330 const FileSystemURL& src_url, |
| 330 const FileSystemURL& dest_url, | 331 const FileSystemURL& dest_url, |
| 332 const CopyFileProgressCallback& progress_callback, |
| 331 const StatusCallback& callback) { | 333 const StatusCallback& callback) { |
| 332 DCHECK(CalledOnValidThread()); | 334 DCHECK(CalledOnValidThread()); |
| 333 impl_->CopyFileLocal(src_url, dest_url, callback); | 335 impl_->CopyFileLocal(src_url, dest_url, progress_callback, callback); |
| 334 } | 336 } |
| 335 | 337 |
| 336 void SyncableFileSystemOperation::MoveFileLocal( | 338 void SyncableFileSystemOperation::MoveFileLocal( |
| 337 const FileSystemURL& src_url, | 339 const FileSystemURL& src_url, |
| 338 const FileSystemURL& dest_url, | 340 const FileSystemURL& dest_url, |
| 339 const StatusCallback& callback) { | 341 const StatusCallback& callback) { |
| 340 DCHECK(CalledOnValidThread()); | 342 DCHECK(CalledOnValidThread()); |
| 341 impl_->MoveFileLocal(src_url, dest_url, callback); | 343 impl_->MoveFileLocal(src_url, dest_url, callback); |
| 342 } | 344 } |
| 343 | 345 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 operation_runner_->OnOperationCompleted(target_paths_); | 393 operation_runner_->OnOperationCompleted(target_paths_); |
| 392 callback.Run(result, bytes, complete); | 394 callback.Run(result, bytes, complete); |
| 393 } | 395 } |
| 394 | 396 |
| 395 void SyncableFileSystemOperation::OnCancelled() { | 397 void SyncableFileSystemOperation::OnCancelled() { |
| 396 DCHECK(!completion_callback_.is_null()); | 398 DCHECK(!completion_callback_.is_null()); |
| 397 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT); | 399 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT); |
| 398 } | 400 } |
| 399 | 401 |
| 400 } // namespace sync_file_system | 402 } // namespace sync_file_system |
| OLD | NEW |