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

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

Issue 12588009: drive: Pass through AboutResouce from server among callbacks in ChangeListLoader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 (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/command_line.h" 10 #include "base/command_line.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 google_apis::GDataErrorCode status, 289 google_apis::GDataErrorCode status,
290 scoped_ptr<google_apis::AboutResource> about_resource) { 290 scoped_ptr<google_apis::AboutResource> about_resource) {
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
292 DCHECK(!callback.is_null()); 292 DCHECK(!callback.is_null());
293 DCHECK(refreshing_); 293 DCHECK(refreshing_);
294 294
295 int64 remote_changestamp = 0; 295 int64 remote_changestamp = 0;
296 if (util::GDataToDriveFileError(status) == DRIVE_FILE_OK) { 296 if (util::GDataToDriveFileError(status) == DRIVE_FILE_OK) {
297 DCHECK(about_resource); 297 DCHECK(about_resource);
298 remote_changestamp = about_resource->largest_change_id(); 298 remote_changestamp = about_resource->largest_change_id();
299
300 DVLOG(1) << "Root folder ID is " << about_resource->root_folder_id();
301 DCHECK(!about_resource->root_folder_id().empty());
302 drive_root_resource_id_ = about_resource->root_folder_id();
hidehiko 2013/03/15 06:57:44 How about passing through AboutResource to L761 vi
Haruki Sato 2013/03/18 04:20:25 Done.
299 } 303 }
300 304
301 resource_metadata_->GetLargestChangestamp( 305 resource_metadata_->GetLargestChangestamp(
302 base::Bind(&ChangeListLoader::CompareChangestampsAndLoadIfNeeded, 306 base::Bind(&ChangeListLoader::CompareChangestampsAndLoadIfNeeded,
303 weak_ptr_factory_.GetWeakPtr(), 307 weak_ptr_factory_.GetWeakPtr(),
304 directory_fetch_info, 308 directory_fetch_info,
305 callback, 309 callback,
306 remote_changestamp)); 310 remote_changestamp));
307 } 311 }
308 312
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 if (error != DRIVE_FILE_OK) { 442 if (error != DRIVE_FILE_OK) {
439 LOG(ERROR) << "Failed to load directory: " 443 LOG(ERROR) << "Failed to load directory: "
440 << directory_fetch_info.resource_id() 444 << directory_fetch_info.resource_id()
441 << ": " << error; 445 << ": " << error;
442 callback.Run(error); 446 callback.Run(error);
443 return; 447 return;
444 } 448 }
445 449
446 // Do not use |change_list_processor_| as it may be in use for other 450 // Do not use |change_list_processor_| as it may be in use for other
447 // purposes. 451 // purposes.
448 ChangeListProcessor change_list_processor(resource_metadata_); 452 ChangeListProcessor change_list_processor(resource_metadata_,
453 drive_root_resource_id_);
449 change_list_processor.FeedToEntryProtoMap(resource_list, NULL, NULL); 454 change_list_processor.FeedToEntryProtoMap(resource_list, NULL, NULL);
450 resource_metadata_->RefreshDirectory( 455 resource_metadata_->RefreshDirectory(
451 directory_fetch_info, 456 directory_fetch_info,
452 change_list_processor.entry_proto_map(), 457 change_list_processor.entry_proto_map(),
453 base::Bind(&ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh, 458 base::Bind(&ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh,
454 weak_ptr_factory_.GetWeakPtr(), 459 weak_ptr_factory_.GetWeakPtr(),
455 callback)); 460 callback));
456 } 461 }
457 462
458 void ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh( 463 void ChangeListLoader::DoLoadDirectoryFromServerAfterRefresh(
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 751
747 void ChangeListLoader::UpdateFromFeed( 752 void ChangeListLoader::UpdateFromFeed(
748 const ScopedVector<google_apis::ResourceList>& feed_list, 753 const ScopedVector<google_apis::ResourceList>& feed_list,
749 bool is_delta_feed, 754 bool is_delta_feed,
750 int64 root_feed_changestamp, 755 int64 root_feed_changestamp,
751 const base::Closure& update_finished_callback) { 756 const base::Closure& update_finished_callback) {
752 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 757 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
753 DCHECK(!update_finished_callback.is_null()); 758 DCHECK(!update_finished_callback.is_null());
754 DVLOG(1) << "Updating directory with a feed"; 759 DVLOG(1) << "Updating directory with a feed";
755 760
756 change_list_processor_.reset(new ChangeListProcessor(resource_metadata_)); 761 change_list_processor_.reset(
762 new ChangeListProcessor(resource_metadata_, drive_root_resource_id_));
757 // Don't send directory content change notification while performing 763 // Don't send directory content change notification while performing
758 // the initial content retrieval. 764 // the initial content retrieval.
759 const bool should_notify_changed_directories = is_delta_feed; 765 const bool should_notify_changed_directories = is_delta_feed;
760 766
761 change_list_processor_->ApplyFeeds( 767 change_list_processor_->ApplyFeeds(
762 feed_list, 768 feed_list,
763 is_delta_feed, 769 is_delta_feed,
764 root_feed_changestamp, 770 root_feed_changestamp,
765 base::Bind(&ChangeListLoader::NotifyDirectoryChanged, 771 base::Bind(&ChangeListLoader::NotifyDirectoryChanged,
766 weak_ptr_factory_.GetWeakPtr(), 772 weak_ptr_factory_.GetWeakPtr(),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 807
802 // Run the callback now that the filesystem is ready. 808 // Run the callback now that the filesystem is ready.
803 load_finished_callback.Run(DRIVE_FILE_OK); 809 load_finished_callback.Run(DRIVE_FILE_OK);
804 810
805 FOR_EACH_OBSERVER(ChangeListLoaderObserver, 811 FOR_EACH_OBSERVER(ChangeListLoaderObserver,
806 observers_, 812 observers_,
807 OnFeedFromServerLoaded()); 813 OnFeedFromServerLoaded());
808 } 814 }
809 815
810 } // namespace drive 816 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698