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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 internal::FileCache* cache) | 281 internal::FileCache* cache) |
282 : blocking_task_runner_(blocking_task_runner), | 282 : blocking_task_runner_(blocking_task_runner), |
283 delegate_(delegate), | 283 delegate_(delegate), |
284 scheduler_(scheduler), | 284 scheduler_(scheduler), |
285 metadata_(metadata), | 285 metadata_(metadata), |
286 cache_(cache), | 286 cache_(cache), |
287 create_file_operation_(new CreateFileOperation(blocking_task_runner, | 287 create_file_operation_(new CreateFileOperation(blocking_task_runner, |
288 delegate, | 288 delegate, |
289 metadata)), | 289 metadata)), |
290 weak_ptr_factory_(this) { | 290 weak_ptr_factory_(this) { |
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 291 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
292 } | 292 } |
293 | 293 |
294 CopyOperation::~CopyOperation() { | 294 CopyOperation::~CopyOperation() { |
295 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 295 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
296 } | 296 } |
297 | 297 |
298 void CopyOperation::Copy(const base::FilePath& src_file_path, | 298 void CopyOperation::Copy(const base::FilePath& src_file_path, |
299 const base::FilePath& dest_file_path, | 299 const base::FilePath& dest_file_path, |
300 bool preserve_last_modified, | 300 bool preserve_last_modified, |
301 const FileOperationCallback& callback) { | 301 const FileOperationCallback& callback) { |
302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 302 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
303 DCHECK(!callback.is_null()); | 303 DCHECK(!callback.is_null()); |
304 | 304 |
305 CopyParams* params = new CopyParams; | 305 CopyParams* params = new CopyParams; |
306 params->src_file_path = src_file_path; | 306 params->src_file_path = src_file_path; |
307 params->dest_file_path = dest_file_path; | 307 params->dest_file_path = dest_file_path; |
308 params->preserve_last_modified = preserve_last_modified; | 308 params->preserve_last_modified = preserve_last_modified; |
309 params->callback = callback; | 309 params->callback = callback; |
310 | 310 |
311 std::vector<std::string>* updated_local_ids = new std::vector<std::string>; | 311 std::vector<std::string>* updated_local_ids = new std::vector<std::string>; |
312 bool* directory_changed = new bool(false); | 312 bool* directory_changed = new bool(false); |
313 bool* should_copy_on_server = new bool(false); | 313 bool* should_copy_on_server = new bool(false); |
314 base::PostTaskAndReplyWithResult( | 314 base::PostTaskAndReplyWithResult( |
315 blocking_task_runner_.get(), | 315 blocking_task_runner_.get(), |
316 FROM_HERE, | 316 FROM_HERE, |
317 base::Bind(&TryToCopyLocally, metadata_, cache_, params, | 317 base::Bind(&TryToCopyLocally, metadata_, cache_, params, |
318 updated_local_ids, directory_changed, should_copy_on_server), | 318 updated_local_ids, directory_changed, should_copy_on_server), |
319 base::Bind(&CopyOperation::CopyAfterTryToCopyLocally, | 319 base::Bind(&CopyOperation::CopyAfterTryToCopyLocally, |
320 weak_ptr_factory_.GetWeakPtr(), base::Owned(params), | 320 weak_ptr_factory_.GetWeakPtr(), base::Owned(params), |
321 base::Owned(updated_local_ids), base::Owned(directory_changed), | 321 base::Owned(updated_local_ids), base::Owned(directory_changed), |
322 base::Owned(should_copy_on_server))); | 322 base::Owned(should_copy_on_server))); |
323 } | 323 } |
324 | 324 |
325 void CopyOperation::CopyAfterTryToCopyLocally( | 325 void CopyOperation::CopyAfterTryToCopyLocally( |
326 const CopyParams* params, | 326 const CopyParams* params, |
327 const std::vector<std::string>* updated_local_ids, | 327 const std::vector<std::string>* updated_local_ids, |
328 const bool* directory_changed, | 328 const bool* directory_changed, |
329 const bool* should_copy_on_server, | 329 const bool* should_copy_on_server, |
330 FileError error) { | 330 FileError error) { |
331 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 331 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
332 DCHECK(!params->callback.is_null()); | 332 DCHECK(!params->callback.is_null()); |
333 | 333 |
334 for (const auto& id : *updated_local_ids) { | 334 for (const auto& id : *updated_local_ids) { |
335 // Syncing for copy should be done in background, so pass the BACKGROUND | 335 // Syncing for copy should be done in background, so pass the BACKGROUND |
336 // context. See: crbug.com/420278. | 336 // context. See: crbug.com/420278. |
337 delegate_->OnEntryUpdatedByOperation(ClientContext(BACKGROUND), id); | 337 delegate_->OnEntryUpdatedByOperation(ClientContext(BACKGROUND), id); |
338 } | 338 } |
339 | 339 |
340 if (*directory_changed) { | 340 if (*directory_changed) { |
341 FileChange changed_file; | 341 FileChange changed_file; |
(...skipping 17 matching lines...) Expand all Loading... |
359 weak_ptr_factory_.GetWeakPtr(), *params)); | 359 weak_ptr_factory_.GetWeakPtr(), *params)); |
360 if (!waiting) | 360 if (!waiting) |
361 params->callback.Run(FILE_ERROR_NOT_FOUND); | 361 params->callback.Run(FILE_ERROR_NOT_FOUND); |
362 } else { | 362 } else { |
363 CopyAfterGetParentResourceId(*params, ¶ms->parent_entry, FILE_ERROR_OK); | 363 CopyAfterGetParentResourceId(*params, ¶ms->parent_entry, FILE_ERROR_OK); |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 void CopyOperation::CopyAfterParentSync(const CopyParams& params, | 367 void CopyOperation::CopyAfterParentSync(const CopyParams& params, |
368 FileError error) { | 368 FileError error) { |
369 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 369 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
370 DCHECK(!params.callback.is_null()); | 370 DCHECK(!params.callback.is_null()); |
371 | 371 |
372 if (error != FILE_ERROR_OK) { | 372 if (error != FILE_ERROR_OK) { |
373 params.callback.Run(error); | 373 params.callback.Run(error); |
374 return; | 374 return; |
375 } | 375 } |
376 | 376 |
377 ResourceEntry* parent = new ResourceEntry; | 377 ResourceEntry* parent = new ResourceEntry; |
378 base::PostTaskAndReplyWithResult( | 378 base::PostTaskAndReplyWithResult( |
379 blocking_task_runner_.get(), | 379 blocking_task_runner_.get(), |
380 FROM_HERE, | 380 FROM_HERE, |
381 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, | 381 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, |
382 base::Unretained(metadata_), | 382 base::Unretained(metadata_), |
383 params.parent_entry.local_id(), | 383 params.parent_entry.local_id(), |
384 parent), | 384 parent), |
385 base::Bind(&CopyOperation::CopyAfterGetParentResourceId, | 385 base::Bind(&CopyOperation::CopyAfterGetParentResourceId, |
386 weak_ptr_factory_.GetWeakPtr(), | 386 weak_ptr_factory_.GetWeakPtr(), |
387 params, | 387 params, |
388 base::Owned(parent))); | 388 base::Owned(parent))); |
389 } | 389 } |
390 | 390 |
391 void CopyOperation::CopyAfterGetParentResourceId(const CopyParams& params, | 391 void CopyOperation::CopyAfterGetParentResourceId(const CopyParams& params, |
392 const ResourceEntry* parent, | 392 const ResourceEntry* parent, |
393 FileError error) { | 393 FileError error) { |
394 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 394 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
395 DCHECK(!params.callback.is_null()); | 395 DCHECK(!params.callback.is_null()); |
396 | 396 |
397 if (error != FILE_ERROR_OK) { | 397 if (error != FILE_ERROR_OK) { |
398 params.callback.Run(error); | 398 params.callback.Run(error); |
399 return; | 399 return; |
400 } | 400 } |
401 | 401 |
402 base::FilePath new_title = params.dest_file_path.BaseName(); | 402 base::FilePath new_title = params.dest_file_path.BaseName(); |
403 if (params.src_entry.file_specific_info().is_hosted_document()) { | 403 if (params.src_entry.file_specific_info().is_hosted_document()) { |
404 // Drop the document extension, which should not be in the title. | 404 // Drop the document extension, which should not be in the title. |
405 // TODO(yoshiki): Remove this code with crbug.com/223304. | 405 // TODO(yoshiki): Remove this code with crbug.com/223304. |
406 new_title = new_title.RemoveExtension(); | 406 new_title = new_title.RemoveExtension(); |
407 } | 407 } |
408 | 408 |
409 base::Time last_modified = | 409 base::Time last_modified = |
410 params.preserve_last_modified ? | 410 params.preserve_last_modified ? |
411 base::Time::FromInternalValue( | 411 base::Time::FromInternalValue( |
412 params.src_entry.file_info().last_modified()) : base::Time(); | 412 params.src_entry.file_info().last_modified()) : base::Time(); |
413 | 413 |
414 CopyResourceOnServer( | 414 CopyResourceOnServer( |
415 params.src_entry.resource_id(), parent->resource_id(), | 415 params.src_entry.resource_id(), parent->resource_id(), |
416 new_title.AsUTF8Unsafe(), last_modified, params.callback); | 416 new_title.AsUTF8Unsafe(), last_modified, params.callback); |
417 } | 417 } |
418 | 418 |
419 void CopyOperation::TransferFileFromLocalToRemote( | 419 void CopyOperation::TransferFileFromLocalToRemote( |
420 const base::FilePath& local_src_path, | 420 const base::FilePath& local_src_path, |
421 const base::FilePath& remote_dest_path, | 421 const base::FilePath& remote_dest_path, |
422 const FileOperationCallback& callback) { | 422 const FileOperationCallback& callback) { |
423 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 423 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
424 DCHECK(!callback.is_null()); | 424 DCHECK(!callback.is_null()); |
425 | 425 |
426 std::string* gdoc_resource_id = new std::string; | 426 std::string* gdoc_resource_id = new std::string; |
427 ResourceEntry* parent_entry = new ResourceEntry; | 427 ResourceEntry* parent_entry = new ResourceEntry; |
428 base::PostTaskAndReplyWithResult( | 428 base::PostTaskAndReplyWithResult( |
429 blocking_task_runner_.get(), | 429 blocking_task_runner_.get(), |
430 FROM_HERE, | 430 FROM_HERE, |
431 base::Bind( | 431 base::Bind( |
432 &PrepareTransferFileFromLocalToRemote, | 432 &PrepareTransferFileFromLocalToRemote, |
433 metadata_, local_src_path, remote_dest_path, | 433 metadata_, local_src_path, remote_dest_path, |
434 gdoc_resource_id, parent_entry), | 434 gdoc_resource_id, parent_entry), |
435 base::Bind( | 435 base::Bind( |
436 &CopyOperation::TransferFileFromLocalToRemoteAfterPrepare, | 436 &CopyOperation::TransferFileFromLocalToRemoteAfterPrepare, |
437 weak_ptr_factory_.GetWeakPtr(), | 437 weak_ptr_factory_.GetWeakPtr(), |
438 local_src_path, remote_dest_path, callback, | 438 local_src_path, remote_dest_path, callback, |
439 base::Owned(gdoc_resource_id), base::Owned(parent_entry))); | 439 base::Owned(gdoc_resource_id), base::Owned(parent_entry))); |
440 } | 440 } |
441 | 441 |
442 void CopyOperation::TransferFileFromLocalToRemoteAfterPrepare( | 442 void CopyOperation::TransferFileFromLocalToRemoteAfterPrepare( |
443 const base::FilePath& local_src_path, | 443 const base::FilePath& local_src_path, |
444 const base::FilePath& remote_dest_path, | 444 const base::FilePath& remote_dest_path, |
445 const FileOperationCallback& callback, | 445 const FileOperationCallback& callback, |
446 std::string* gdoc_resource_id, | 446 std::string* gdoc_resource_id, |
447 ResourceEntry* parent_entry, | 447 ResourceEntry* parent_entry, |
448 FileError error) { | 448 FileError error) { |
449 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 449 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
450 DCHECK(!callback.is_null()); | 450 DCHECK(!callback.is_null()); |
451 | 451 |
452 if (error != FILE_ERROR_OK) { | 452 if (error != FILE_ERROR_OK) { |
453 callback.Run(error); | 453 callback.Run(error); |
454 return; | 454 return; |
455 } | 455 } |
456 | 456 |
457 // For regular files, schedule the transfer. | 457 // For regular files, schedule the transfer. |
458 if (gdoc_resource_id->empty()) { | 458 if (gdoc_resource_id->empty()) { |
459 ScheduleTransferRegularFile(local_src_path, remote_dest_path, callback); | 459 ScheduleTransferRegularFile(local_src_path, remote_dest_path, callback); |
(...skipping 16 matching lines...) Expand all Loading... |
476 blocking_task_runner_.get(), | 476 blocking_task_runner_.get(), |
477 FROM_HERE, | 477 FROM_HERE, |
478 base::Bind(&LocalWorkForTransferJsonGdocFile, metadata_, params), | 478 base::Bind(&LocalWorkForTransferJsonGdocFile, metadata_, params), |
479 base::Bind(&CopyOperation::TransferJsonGdocFileAfterLocalWork, | 479 base::Bind(&CopyOperation::TransferJsonGdocFileAfterLocalWork, |
480 weak_ptr_factory_.GetWeakPtr(), base::Owned(params))); | 480 weak_ptr_factory_.GetWeakPtr(), base::Owned(params))); |
481 } | 481 } |
482 | 482 |
483 void CopyOperation::TransferJsonGdocFileAfterLocalWork( | 483 void CopyOperation::TransferJsonGdocFileAfterLocalWork( |
484 TransferJsonGdocParams* params, | 484 TransferJsonGdocParams* params, |
485 FileError error) { | 485 FileError error) { |
486 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 486 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
487 | 487 |
488 if (error != FILE_ERROR_OK) { | 488 if (error != FILE_ERROR_OK) { |
489 params->callback.Run(error); | 489 params->callback.Run(error); |
490 return; | 490 return; |
491 } | 491 } |
492 | 492 |
493 switch (params->location_type) { | 493 switch (params->location_type) { |
494 // When |resource_id| is found in the local metadata and it has a specific | 494 // When |resource_id| is found in the local metadata and it has a specific |
495 // parent folder, we assume the user's intention is to copy the document and | 495 // parent folder, we assume the user's intention is to copy the document and |
496 // thus perform the server-side copy operation. | 496 // thus perform the server-side copy operation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 break; | 534 break; |
535 } | 535 } |
536 } | 536 } |
537 | 537 |
538 void CopyOperation::CopyResourceOnServer( | 538 void CopyOperation::CopyResourceOnServer( |
539 const std::string& resource_id, | 539 const std::string& resource_id, |
540 const std::string& parent_resource_id, | 540 const std::string& parent_resource_id, |
541 const std::string& new_title, | 541 const std::string& new_title, |
542 const base::Time& last_modified, | 542 const base::Time& last_modified, |
543 const FileOperationCallback& callback) { | 543 const FileOperationCallback& callback) { |
544 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 544 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
545 DCHECK(!callback.is_null()); | 545 DCHECK(!callback.is_null()); |
546 | 546 |
547 scheduler_->CopyResource( | 547 scheduler_->CopyResource( |
548 resource_id, parent_resource_id, new_title, last_modified, | 548 resource_id, parent_resource_id, new_title, last_modified, |
549 base::Bind(&CopyOperation::UpdateAfterServerSideOperation, | 549 base::Bind(&CopyOperation::UpdateAfterServerSideOperation, |
550 weak_ptr_factory_.GetWeakPtr(), | 550 weak_ptr_factory_.GetWeakPtr(), |
551 callback)); | 551 callback)); |
552 } | 552 } |
553 | 553 |
554 void CopyOperation::UpdateAfterServerSideOperation( | 554 void CopyOperation::UpdateAfterServerSideOperation( |
555 const FileOperationCallback& callback, | 555 const FileOperationCallback& callback, |
556 google_apis::DriveApiErrorCode status, | 556 google_apis::DriveApiErrorCode status, |
557 scoped_ptr<google_apis::FileResource> entry) { | 557 scoped_ptr<google_apis::FileResource> entry) { |
558 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 558 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
559 DCHECK(!callback.is_null()); | 559 DCHECK(!callback.is_null()); |
560 | 560 |
561 FileError error = GDataToFileError(status); | 561 FileError error = GDataToFileError(status); |
562 if (error != FILE_ERROR_OK) { | 562 if (error != FILE_ERROR_OK) { |
563 callback.Run(error); | 563 callback.Run(error); |
564 return; | 564 return; |
565 } | 565 } |
566 | 566 |
567 ResourceEntry* resource_entry = new ResourceEntry; | 567 ResourceEntry* resource_entry = new ResourceEntry; |
568 | 568 |
(...skipping 13 matching lines...) Expand all Loading... |
582 callback, | 582 callback, |
583 base::Owned(file_path), | 583 base::Owned(file_path), |
584 base::Owned(resource_entry))); | 584 base::Owned(resource_entry))); |
585 } | 585 } |
586 | 586 |
587 void CopyOperation::UpdateAfterLocalStateUpdate( | 587 void CopyOperation::UpdateAfterLocalStateUpdate( |
588 const FileOperationCallback& callback, | 588 const FileOperationCallback& callback, |
589 base::FilePath* file_path, | 589 base::FilePath* file_path, |
590 const ResourceEntry* entry, | 590 const ResourceEntry* entry, |
591 FileError error) { | 591 FileError error) { |
592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 592 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
593 DCHECK(!callback.is_null()); | 593 DCHECK(!callback.is_null()); |
594 | 594 |
595 if (error == FILE_ERROR_OK) { | 595 if (error == FILE_ERROR_OK) { |
596 FileChange changed_file; | 596 FileChange changed_file; |
597 changed_file.Update(*file_path, *entry, FileChange::ADD_OR_UPDATE); | 597 changed_file.Update(*file_path, *entry, FileChange::ADD_OR_UPDATE); |
598 delegate_->OnFileChangedByOperation(changed_file); | 598 delegate_->OnFileChangedByOperation(changed_file); |
599 } | 599 } |
600 callback.Run(error); | 600 callback.Run(error); |
601 } | 601 } |
602 | 602 |
603 void CopyOperation::ScheduleTransferRegularFile( | 603 void CopyOperation::ScheduleTransferRegularFile( |
604 const base::FilePath& local_src_path, | 604 const base::FilePath& local_src_path, |
605 const base::FilePath& remote_dest_path, | 605 const base::FilePath& remote_dest_path, |
606 const FileOperationCallback& callback) { | 606 const FileOperationCallback& callback) { |
607 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 607 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
608 DCHECK(!callback.is_null()); | 608 DCHECK(!callback.is_null()); |
609 | 609 |
610 create_file_operation_->CreateFile( | 610 create_file_operation_->CreateFile( |
611 remote_dest_path, | 611 remote_dest_path, |
612 false, // Not exclusive (OK even if a file already exists). | 612 false, // Not exclusive (OK even if a file already exists). |
613 std::string(), // no specific mime type; CreateFile should guess it. | 613 std::string(), // no specific mime type; CreateFile should guess it. |
614 base::Bind(&CopyOperation::ScheduleTransferRegularFileAfterCreate, | 614 base::Bind(&CopyOperation::ScheduleTransferRegularFileAfterCreate, |
615 weak_ptr_factory_.GetWeakPtr(), | 615 weak_ptr_factory_.GetWeakPtr(), |
616 local_src_path, remote_dest_path, callback)); | 616 local_src_path, remote_dest_path, callback)); |
617 } | 617 } |
618 | 618 |
619 void CopyOperation::ScheduleTransferRegularFileAfterCreate( | 619 void CopyOperation::ScheduleTransferRegularFileAfterCreate( |
620 const base::FilePath& local_src_path, | 620 const base::FilePath& local_src_path, |
621 const base::FilePath& remote_dest_path, | 621 const base::FilePath& remote_dest_path, |
622 const FileOperationCallback& callback, | 622 const FileOperationCallback& callback, |
623 FileError error) { | 623 FileError error) { |
624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 624 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
625 DCHECK(!callback.is_null()); | 625 DCHECK(!callback.is_null()); |
626 | 626 |
627 if (error != FILE_ERROR_OK) { | 627 if (error != FILE_ERROR_OK) { |
628 callback.Run(error); | 628 callback.Run(error); |
629 return; | 629 return; |
630 } | 630 } |
631 | 631 |
632 std::string* local_id = new std::string; | 632 std::string* local_id = new std::string; |
633 ResourceEntry* entry = new ResourceEntry; | 633 ResourceEntry* entry = new ResourceEntry; |
634 base::PostTaskAndReplyWithResult( | 634 base::PostTaskAndReplyWithResult( |
(...skipping 14 matching lines...) Expand all Loading... |
649 base::Owned(entry), | 649 base::Owned(entry), |
650 base::Owned(local_id))); | 650 base::Owned(local_id))); |
651 } | 651 } |
652 | 652 |
653 void CopyOperation::ScheduleTransferRegularFileAfterUpdateLocalState( | 653 void CopyOperation::ScheduleTransferRegularFileAfterUpdateLocalState( |
654 const FileOperationCallback& callback, | 654 const FileOperationCallback& callback, |
655 const base::FilePath& remote_dest_path, | 655 const base::FilePath& remote_dest_path, |
656 const ResourceEntry* entry, | 656 const ResourceEntry* entry, |
657 std::string* local_id, | 657 std::string* local_id, |
658 FileError error) { | 658 FileError error) { |
659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 659 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
660 DCHECK(!callback.is_null()); | 660 DCHECK(!callback.is_null()); |
661 | 661 |
662 if (error == FILE_ERROR_OK) { | 662 if (error == FILE_ERROR_OK) { |
663 FileChange changed_file; | 663 FileChange changed_file; |
664 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); | 664 changed_file.Update(remote_dest_path, *entry, FileChange::ADD_OR_UPDATE); |
665 delegate_->OnFileChangedByOperation(changed_file); | 665 delegate_->OnFileChangedByOperation(changed_file); |
666 // Syncing for copy should be done in background, so pass the BACKGROUND | 666 // Syncing for copy should be done in background, so pass the BACKGROUND |
667 // context. See: crbug.com/420278. | 667 // context. See: crbug.com/420278. |
668 delegate_->OnEntryUpdatedByOperation(ClientContext(BACKGROUND), *local_id); | 668 delegate_->OnEntryUpdatedByOperation(ClientContext(BACKGROUND), *local_id); |
669 } | 669 } |
670 callback.Run(error); | 670 callback.Run(error); |
671 } | 671 } |
672 | 672 |
673 } // namespace file_system | 673 } // namespace file_system |
674 } // namespace drive | 674 } // namespace drive |
OLD | NEW |