OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/drive/file_system/copy_operation.h" | 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 366 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
367 DCHECK(!params.callback.is_null()); | 367 DCHECK(!params.callback.is_null()); |
368 | 368 |
369 if (error != FILE_ERROR_OK) { | 369 if (error != FILE_ERROR_OK) { |
370 params.callback.Run(error); | 370 params.callback.Run(error); |
371 return; | 371 return; |
372 } | 372 } |
373 | 373 |
374 ResourceEntry* parent = new ResourceEntry; | 374 ResourceEntry* parent = new ResourceEntry; |
375 base::PostTaskAndReplyWithResult( | 375 base::PostTaskAndReplyWithResult( |
376 blocking_task_runner_, | 376 blocking_task_runner_.get(), |
377 FROM_HERE, | 377 FROM_HERE, |
378 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, | 378 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, |
379 base::Unretained(metadata_), | 379 base::Unretained(metadata_), |
380 params.parent_entry.local_id(), parent), | 380 params.parent_entry.local_id(), |
| 381 parent), |
381 base::Bind(&CopyOperation::CopyAfterGetParentResourceId, | 382 base::Bind(&CopyOperation::CopyAfterGetParentResourceId, |
382 weak_ptr_factory_.GetWeakPtr(), params, base::Owned(parent))); | 383 weak_ptr_factory_.GetWeakPtr(), |
| 384 params, |
| 385 base::Owned(parent))); |
383 } | 386 } |
384 | 387 |
385 void CopyOperation::CopyAfterGetParentResourceId(const CopyParams& params, | 388 void CopyOperation::CopyAfterGetParentResourceId(const CopyParams& params, |
386 const ResourceEntry* parent, | 389 const ResourceEntry* parent, |
387 FileError error) { | 390 FileError error) { |
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 391 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
389 DCHECK(!params.callback.is_null()); | 392 DCHECK(!params.callback.is_null()); |
390 | 393 |
391 if (error != FILE_ERROR_OK) { | 394 if (error != FILE_ERROR_OK) { |
392 params.callback.Run(error); | 395 params.callback.Run(error); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 FileChange changed_file; | 661 FileChange changed_file; |
659 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); | 662 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); |
660 delegate_->OnFileChangedByOperation(changed_file); | 663 delegate_->OnFileChangedByOperation(changed_file); |
661 delegate_->OnEntryUpdatedByOperation(*local_id); | 664 delegate_->OnEntryUpdatedByOperation(*local_id); |
662 } | 665 } |
663 callback.Run(error); | 666 callback.Run(error); |
664 } | 667 } |
665 | 668 |
666 } // namespace file_system | 669 } // namespace file_system |
667 } // namespace drive | 670 } // namespace drive |
OLD | NEW |