OLD | NEW |
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/list_changes_task.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/list_changes_task.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 void ListChangesTask::StartListing(scoped_ptr<SyncTaskToken> token) { | 51 void ListChangesTask::StartListing(scoped_ptr<SyncTaskToken> token) { |
52 drive_service()->GetChangeList( | 52 drive_service()->GetChangeList( |
53 metadata_database()->GetLargestFetchedChangeID() + 1, | 53 metadata_database()->GetLargestFetchedChangeID() + 1, |
54 base::Bind(&ListChangesTask::DidListChanges, | 54 base::Bind(&ListChangesTask::DidListChanges, |
55 weak_ptr_factory_.GetWeakPtr(), base::Passed(&token))); | 55 weak_ptr_factory_.GetWeakPtr(), base::Passed(&token))); |
56 } | 56 } |
57 | 57 |
58 void ListChangesTask::DidListChanges( | 58 void ListChangesTask::DidListChanges( |
59 scoped_ptr<SyncTaskToken> token, | 59 scoped_ptr<SyncTaskToken> token, |
60 google_apis::GDataErrorCode error, | 60 google_apis::DriveApiErrorCode error, |
61 scoped_ptr<google_apis::ChangeList> change_list) { | 61 scoped_ptr<google_apis::ChangeList> change_list) { |
62 SyncStatusCode status = GDataErrorCodeToSyncStatusCode(error); | 62 SyncStatusCode status = DriveApiErrorCodeToSyncStatusCode(error); |
63 if (status != SYNC_STATUS_OK) { | 63 if (status != SYNC_STATUS_OK) { |
64 token->RecordLog("Failed to fetch change list."); | 64 token->RecordLog("Failed to fetch change list."); |
65 SyncTaskManager::NotifyTaskDone( | 65 SyncTaskManager::NotifyTaskDone( |
66 token.Pass(), SYNC_STATUS_NETWORK_ERROR); | 66 token.Pass(), SYNC_STATUS_NETWORK_ERROR); |
67 return; | 67 return; |
68 } | 68 } |
69 | 69 |
70 if (!change_list) { | 70 if (!change_list) { |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 token->RecordLog("Got invalid change list."); | 72 token->RecordLog("Got invalid change list."); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return sync_context_->GetMetadataDatabase(); | 140 return sync_context_->GetMetadataDatabase(); |
141 } | 141 } |
142 | 142 |
143 drive::DriveServiceInterface* ListChangesTask::drive_service() { | 143 drive::DriveServiceInterface* ListChangesTask::drive_service() { |
144 set_used_network(true); | 144 set_used_network(true); |
145 return sync_context_->GetDriveService(); | 145 return sync_context_->GetDriveService(); |
146 } | 146 } |
147 | 147 |
148 } // namespace drive_backend | 148 } // namespace drive_backend |
149 } // namespace sync_file_system | 149 } // namespace sync_file_system |
OLD | NEW |