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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend_v1/api_util.cc

Issue 309463002: drive: Change DriveServiceInterface::GetChangeList's callback type to ChangeListCallback (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_v1/api_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <sstream> 9 #include <sstream>
10 #include <string> 10 #include <string>
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 drive_service_->GetResourceListInDirectory(directory_resource_id, callback); 473 drive_service_->GetResourceListInDirectory(directory_resource_id, callback);
474 } 474 }
475 475
476 void APIUtil::ListChanges(int64 start_changestamp, 476 void APIUtil::ListChanges(int64 start_changestamp,
477 const ResourceListCallback& callback) { 477 const ResourceListCallback& callback) {
478 DCHECK(CalledOnValidThread()); 478 DCHECK(CalledOnValidThread());
479 DVLOG(2) << "Listing changes since: " << start_changestamp; 479 DVLOG(2) << "Listing changes since: " << start_changestamp;
480 480
481 drive_service_->GetChangeList( 481 drive_service_->GetChangeList(
482 start_changestamp, 482 start_changestamp,
483 base::Bind(&APIUtil::DidGetResourceList, AsWeakPtr(), callback)); 483 base::Bind(&APIUtil::DidGetChangeList, AsWeakPtr(), callback));
484 } 484 }
485 485
486 void APIUtil::ContinueListing(const GURL& next_link, 486 void APIUtil::ContinueListing(const GURL& next_link,
487 const ResourceListCallback& callback) { 487 const ResourceListCallback& callback) {
488 DCHECK(CalledOnValidThread()); 488 DCHECK(CalledOnValidThread());
489 DVLOG(2) << "Continue listing on feed: " << next_link.spec(); 489 DVLOG(2) << "Continue listing on feed: " << next_link.spec();
490 490
491 drive_service_->GetRemainingFileList( 491 drive_service_->GetRemainingFileList(
492 next_link, 492 next_link,
493 base::Bind(&APIUtil::DidGetResourceList, AsWeakPtr(), callback)); 493 base::Bind(&APIUtil::DidGetResourceList, AsWeakPtr(), callback));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 FOR_EACH_OBSERVER(APIUtilObserver, observers_, OnNetworkConnected()); 668 FOR_EACH_OBSERVER(APIUtilObserver, observers_, OnNetworkConnected());
669 return; 669 return;
670 } 670 }
671 // We're now disconnected, reset the drive_uploader_ to force stop 671 // We're now disconnected, reset the drive_uploader_ to force stop
672 // uploading, otherwise the uploader may get stuck. 672 // uploading, otherwise the uploader may get stuck.
673 // TODO(kinuko): Check the uploader behavior if it's the expected behavior 673 // TODO(kinuko): Check the uploader behavior if it's the expected behavior
674 // (http://crbug.com/223818) 674 // (http://crbug.com/223818)
675 CancelAllUploads(google_apis::GDATA_NO_CONNECTION); 675 CancelAllUploads(google_apis::GDATA_NO_CONNECTION);
676 } 676 }
677 677
678 void APIUtil::DidGetChangeList(
679 const ResourceListCallback& callback,
680 google_apis::GDataErrorCode error,
681 scoped_ptr<google_apis::ChangeList> change_list) {
682 DCHECK(CalledOnValidThread());
683
684 if (error != google_apis::HTTP_SUCCESS) {
685 DVLOG(2) << "Error on listing changes: " << error;
686 callback.Run(error, scoped_ptr<google_apis::ResourceList>());
687 return;
688 }
689
690 DVLOG(2) << "Got change list";
691 DCHECK(change_list);
692 callback.Run(error,
693 drive::util::ConvertChangeListToResourceList(*change_list));
694 }
695
678 void APIUtil::DidGetResourceList( 696 void APIUtil::DidGetResourceList(
679 const ResourceListCallback& callback, 697 const ResourceListCallback& callback,
680 google_apis::GDataErrorCode error, 698 google_apis::GDataErrorCode error,
681 scoped_ptr<google_apis::ResourceList> resource_list) { 699 scoped_ptr<google_apis::ResourceList> resource_list) {
682 DCHECK(CalledOnValidThread()); 700 DCHECK(CalledOnValidThread());
683 701
684 if (error != google_apis::HTTP_SUCCESS) { 702 if (error != google_apis::HTTP_SUCCESS) {
685 DVLOG(2) << "Error on listing resource: " << error; 703 DVLOG(2) << "Error on listing resource: " << error;
686 callback.Run(error, scoped_ptr<google_apis::ResourceList>()); 704 callback.Run(error, scoped_ptr<google_apis::ResourceList>());
687 return; 705 return;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 } 1141 }
1124 1142
1125 std::string APIUtil::GetRootResourceId() const { 1143 std::string APIUtil::GetRootResourceId() const {
1126 if (IsDriveAPIDisabled()) 1144 if (IsDriveAPIDisabled())
1127 return drive_service_->GetRootResourceId(); 1145 return drive_service_->GetRootResourceId();
1128 return root_resource_id_; 1146 return root_resource_id_;
1129 } 1147 }
1130 1148
1131 } // namespace drive_backend 1149 } // namespace drive_backend
1132 } // namespace sync_file_system 1150 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend_v1/api_util.h ('k') | google_apis/drive/drive_api_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698