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

Side by Side Diff: chrome/browser/chromeos/drive/change_list_loader.cc

Issue 23647010: Fix next page fetching failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/change_list_loader.h" 5 #include "chrome/browser/chromeos/drive/change_list_loader.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 std::string resource_id = directory_resource_id_; 232 std::string resource_id = directory_resource_id_;
233 if (util::IsDriveV2ApiEnabled() && 233 if (util::IsDriveV2ApiEnabled() &&
234 directory_resource_id_ == root_folder_id_) { 234 directory_resource_id_ == root_folder_id_) {
235 // GData WAPI doesn't accept the root directory id which is used in Drive 235 // GData WAPI doesn't accept the root directory id which is used in Drive
236 // API v2. So it is necessary to translate it here. 236 // API v2. So it is necessary to translate it here.
237 resource_id = util::kWapiRootDirectoryResourceId; 237 resource_id = util::kWapiRootDirectoryResourceId;
238 } 238 }
239 239
240 scheduler_->GetResourceListInDirectoryByWapi( 240 scheduler_->GetResourceListInDirectoryByWapi(
241 resource_id, 241 resource_id,
242 base::Bind(&FastFetchFeedFetcher::OnFileListFetched, 242 base::Bind(&FastFetchFeedFetcher::OnResourceListFetched,
243 weak_ptr_factory_.GetWeakPtr(), callback)); 243 weak_ptr_factory_.GetWeakPtr(), callback));
244 } 244 }
245 245
246 void OnFileListFetched( 246 void OnResourceListFetched(
247 const FeedFetcherCallback& callback, 247 const FeedFetcherCallback& callback,
248 google_apis::GDataErrorCode status, 248 google_apis::GDataErrorCode status,
249 scoped_ptr<google_apis::ResourceList> resource_list) { 249 scoped_ptr<google_apis::ResourceList> resource_list) {
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
251 DCHECK(!callback.is_null()); 251 DCHECK(!callback.is_null());
252 252
253 FileError error = GDataToFileError(status); 253 FileError error = GDataToFileError(status);
254 if (error != FILE_ERROR_OK) { 254 if (error != FILE_ERROR_OK) {
255 callback.Run(error, ScopedVector<ChangeList>()); 255 callback.Run(error, ScopedVector<ChangeList>());
256 return; 256 return;
257 } 257 }
258 258
259 // Add the current change list to the list of collected lists. 259 // Add the current change list to the list of collected lists.
260 DCHECK(resource_list); 260 DCHECK(resource_list);
261 ChangeList* change_list = new ChangeList(*resource_list); 261 ChangeList* change_list = new ChangeList(*resource_list);
262 if (util::IsDriveV2ApiEnabled()) 262 if (util::IsDriveV2ApiEnabled())
263 FixResourceIdInChangeList(change_list); 263 FixResourceIdInChangeList(change_list);
264 change_lists_.push_back(change_list); 264 change_lists_.push_back(change_list);
265 265
266 GURL next_url; 266 GURL next_url;
267 if (resource_list->GetNextFeedURL(&next_url) && !next_url.is_empty()) { 267 if (resource_list->GetNextFeedURL(&next_url) && !next_url.is_empty()) {
268 // There is the remaining result so fetch it. 268 // There is the remaining result so fetch it.
269 scheduler_->GetRemainingFileList( 269 scheduler_->GetRemainingResourceList(
270 next_url, 270 next_url,
271 base::Bind(&FastFetchFeedFetcher::OnFileListFetched, 271 base::Bind(&FastFetchFeedFetcher::OnResourceListFetched,
272 weak_ptr_factory_.GetWeakPtr(), callback)); 272 weak_ptr_factory_.GetWeakPtr(), callback));
273 return; 273 return;
274 } 274 }
275 275
276 // Note: The fetcher is managed by ChangeListLoader, and the instance 276 // Note: The fetcher is managed by ChangeListLoader, and the instance
277 // will be deleted in the callback. Do not touch the fields after this 277 // will be deleted in the callback. Do not touch the fields after this
278 // invocation. 278 // invocation.
279 callback.Run(FILE_ERROR_OK, change_lists_.Pass()); 279 callback.Run(FILE_ERROR_OK, change_lists_.Pass());
280 } 280 }
281 281
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_, 968 FOR_EACH_OBSERVER(ChangeListLoaderObserver, observers_,
969 OnDirectoryChanged(*dir_iter)); 969 OnDirectoryChanged(*dir_iter));
970 } 970 }
971 } 971 }
972 972
973 callback.Run(); 973 callback.Run();
974 } 974 }
975 975
976 } // namespace internal 976 } // namespace internal
977 } // namespace drive 977 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698