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 ErrorBehavior error_behavior, |
121 const CopyProgressCallback& progress_callback, | 122 const CopyProgressCallback& progress_callback, |
122 const StatusCallback& callback) { | 123 const StatusCallback& callback) { |
123 DCHECK(CalledOnValidThread()); | 124 DCHECK(CalledOnValidThread()); |
124 if (!operation_runner_.get()) { | 125 if (!operation_runner_.get()) { |
125 callback.Run(base::File::FILE_ERROR_NOT_FOUND); | 126 callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
126 return; | 127 return; |
127 } | 128 } |
128 DCHECK(operation_runner_.get()); | 129 DCHECK(operation_runner_.get()); |
129 target_paths_.push_back(dest_url); | 130 target_paths_.push_back(dest_url); |
130 completion_callback_ = callback; | 131 completion_callback_ = callback; |
131 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( | 132 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( |
132 weak_factory_.GetWeakPtr(), | 133 weak_factory_.GetWeakPtr(), |
133 base::Bind(&FileSystemOperation::Copy, | 134 base::Bind(&FileSystemOperation::Copy, base::Unretained(impl_.get()), |
134 base::Unretained(impl_.get()), | 135 src_url, dest_url, option, error_behavior, progress_callback, |
135 src_url, dest_url, option, progress_callback, | |
136 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); | 136 base::Bind(&self::DidFinish, weak_factory_.GetWeakPtr())))); |
137 operation_runner_->PostOperationTask(task.Pass()); | 137 operation_runner_->PostOperationTask(task.Pass()); |
138 } | 138 } |
139 | 139 |
140 void SyncableFileSystemOperation::Move( | 140 void SyncableFileSystemOperation::Move( |
141 const FileSystemURL& src_url, | 141 const FileSystemURL& src_url, |
142 const FileSystemURL& dest_url, | 142 const FileSystemURL& dest_url, |
143 CopyOrMoveOption option, | 143 CopyOrMoveOption option, |
144 const StatusCallback& callback) { | 144 const StatusCallback& callback) { |
145 DCHECK(CalledOnValidThread()); | 145 DCHECK(CalledOnValidThread()); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 operation_runner_->OnOperationCompleted(target_paths_); | 387 operation_runner_->OnOperationCompleted(target_paths_); |
388 callback.Run(result, bytes, complete); | 388 callback.Run(result, bytes, complete); |
389 } | 389 } |
390 | 390 |
391 void SyncableFileSystemOperation::OnCancelled() { | 391 void SyncableFileSystemOperation::OnCancelled() { |
392 DCHECK(!completion_callback_.is_null()); | 392 DCHECK(!completion_callback_.is_null()); |
393 completion_callback_.Run(base::File::FILE_ERROR_ABORT); | 393 completion_callback_.Run(base::File::FILE_ERROR_ABORT); |
394 } | 394 } |
395 | 395 |
396 } // namespace sync_file_system | 396 } // namespace sync_file_system |
OLD | NEW |