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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc

Issue 305913002: drive: Replace GetResourceListCallback in DriveServiceInterface with FileListCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/drive_backend/remote_to_local_syncer.h " 5 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h "
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 DCHECK(dirty_tracker_->has_synced_details()); 524 DCHECK(dirty_tracker_->has_synced_details());
525 DCHECK(!dirty_tracker_->synced_details().missing()); 525 DCHECK(!dirty_tracker_->synced_details().missing());
526 DCHECK_EQ(FILE_KIND_FOLDER, dirty_tracker_->synced_details().file_kind()); 526 DCHECK_EQ(FILE_KIND_FOLDER, dirty_tracker_->synced_details().file_kind());
527 DCHECK(dirty_tracker_->needs_folder_listing()); 527 DCHECK(dirty_tracker_->needs_folder_listing());
528 528
529 DCHECK(remote_metadata_); 529 DCHECK(remote_metadata_);
530 DCHECK(remote_metadata_->has_details()); 530 DCHECK(remote_metadata_->has_details());
531 DCHECK(!remote_metadata_->details().missing()); 531 DCHECK(!remote_metadata_->details().missing());
532 532
533 // TODO(tzik): Replace this call with ChildList version. 533 // TODO(tzik): Replace this call with ChildList version.
534 drive_service()->GetResourceListInDirectory( 534 drive_service()->GetFileListInDirectory(
535 dirty_tracker_->file_id(), 535 dirty_tracker_->file_id(),
536 base::Bind(&RemoteToLocalSyncer::DidListFolderContent, 536 base::Bind(&RemoteToLocalSyncer::DidListFolderContent,
537 weak_ptr_factory_.GetWeakPtr(), 537 weak_ptr_factory_.GetWeakPtr(),
538 callback, 538 callback,
539 base::Passed(make_scoped_ptr(new FileIDList)))); 539 base::Passed(make_scoped_ptr(new FileIDList))));
540 } 540 }
541 541
542 void RemoteToLocalSyncer::DidListFolderContent( 542 void RemoteToLocalSyncer::DidListFolderContent(
543 const SyncStatusCallback& callback, 543 const SyncStatusCallback& callback,
544 scoped_ptr<FileIDList> children, 544 scoped_ptr<FileIDList> children,
545 google_apis::GDataErrorCode error, 545 google_apis::GDataErrorCode error,
546 scoped_ptr<google_apis::ResourceList> resource_list) { 546 scoped_ptr<google_apis::FileList> file_list) {
547 SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); 547 SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error);
548 if (status != SYNC_STATUS_OK) { 548 if (status != SYNC_STATUS_OK) {
549 callback.Run(status); 549 callback.Run(status);
550 return; 550 return;
551 } 551 }
552 552
553 if (!resource_list) { 553 if (!file_list) {
554 NOTREACHED(); 554 NOTREACHED();
555 callback.Run(SYNC_STATUS_FAILED); 555 callback.Run(SYNC_STATUS_FAILED);
556 return; 556 return;
557 } 557 }
558 558
559 children->reserve(children->size() + resource_list->entries().size()); 559 children->reserve(children->size() + file_list->items().size());
560 for (ScopedVector<google_apis::ResourceEntry>::const_iterator itr = 560 for (ScopedVector<google_apis::FileResource>::const_iterator itr =
561 resource_list->entries().begin(); 561 file_list->items().begin();
562 itr != resource_list->entries().end(); 562 itr != file_list->items().end();
563 ++itr) { 563 ++itr) {
564 children->push_back((*itr)->resource_id()); 564 children->push_back((*itr)->file_id());
565 } 565 }
566 566
567 GURL next_feed; 567 if (!file_list->next_link().is_empty()) {
568 if (resource_list->GetNextFeedURL(&next_feed)) {
569 drive_service()->GetRemainingFileList( 568 drive_service()->GetRemainingFileList(
570 next_feed, 569 file_list->next_link(),
571 base::Bind(&RemoteToLocalSyncer::DidListFolderContent, 570 base::Bind(&RemoteToLocalSyncer::DidListFolderContent,
572 weak_ptr_factory_.GetWeakPtr(), 571 weak_ptr_factory_.GetWeakPtr(),
573 callback, base::Passed(&children))); 572 callback, base::Passed(&children)));
574 return; 573 return;
575 } 574 }
576 575
577 metadata_database()->PopulateFolderByChildList( 576 metadata_database()->PopulateFolderByChildList(
578 dirty_tracker_->file_id(), *children, callback); 577 dirty_tracker_->file_id(), *children, callback);
579 } 578 }
580 579
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 return sync_context_->GetMetadataDatabase(); 761 return sync_context_->GetMetadataDatabase();
763 } 762 }
764 763
765 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { 764 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() {
766 DCHECK(sync_context_->GetRemoteChangeProcessor()); 765 DCHECK(sync_context_->GetRemoteChangeProcessor());
767 return sync_context_->GetRemoteChangeProcessor(); 766 return sync_context_->GetRemoteChangeProcessor();
768 } 767 }
769 768
770 } // namespace drive_backend 769 } // namespace drive_backend
771 } // namespace sync_file_system 770 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698