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

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

Powered by Google App Engine
This is Rietveld 408576698