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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc

Issue 10837338: Remove "GData" prefix from non-GData specific classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 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/gdata/gdata_wapi_feed_loader.h" 5 #include "chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 void GDataWapiFeedLoader::ReloadFromServerIfNeeded( 264 void GDataWapiFeedLoader::ReloadFromServerIfNeeded(
265 ContentOrigin initial_origin, 265 ContentOrigin initial_origin,
266 int64 local_changestamp, 266 int64 local_changestamp,
267 const FileOperationCallback& callback) { 267 const FileOperationCallback& callback) {
268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
269 269
270 DVLOG(1) << "ReloadFeedFromServerIfNeeded local_changestamp=" 270 DVLOG(1) << "ReloadFeedFromServerIfNeeded local_changestamp="
271 << local_changestamp << ", initial_origin=" << initial_origin; 271 << local_changestamp << ", initial_origin=" << initial_origin;
272 272
273 #if 0
kochi 2012/08/21 05:09:23 Removed.
273 // First fetch the latest changestamp to see if there were any new changes 274 // First fetch the latest changestamp to see if there were any new changes
274 // there at all. 275 // there at all.
275 if (gdata::util::IsDriveV2ApiEnabled()) { 276 if (gdata::util::IsDriveV2ApiEnabled()) {
276 drive_service_->GetAccountMetadata( 277 drive_service_->GetAccountMetadata(
277 base::Bind(&GDataWapiFeedLoader::OnGetAboutResource, 278 base::Bind(&GDataWapiFeedLoader::OnGetAboutResource,
278 weak_ptr_factory_.GetWeakPtr(), 279 weak_ptr_factory_.GetWeakPtr(),
279 initial_origin, 280 initial_origin,
280 local_changestamp, 281 local_changestamp,
281 callback)); 282 callback));
282 // Drive v2 needs a separate application list fetch operation. 283 // Drive v2 needs a separate application list fetch operation.
283 // TODO(kochi): Application list rarely changes and do not necessarily 284 // TODO(kochi): Application list rarely changes and do not necessarily
284 // refresed as often as files. 285 // refresed as often as files.
285 drive_service_->GetApplicationInfo( 286 drive_service_->GetApplicationInfo(
286 base::Bind(&GDataWapiFeedLoader::OnGetApplicationList, 287 base::Bind(&GDataWapiFeedLoader::OnGetApplicationList,
287 weak_ptr_factory_.GetWeakPtr())); 288 weak_ptr_factory_.GetWeakPtr()));
288 return; 289 return;
289 } 290 }
291 #endif
290 292
291 drive_service_->GetAccountMetadata( 293 drive_service_->GetAccountMetadata(
292 base::Bind(&GDataWapiFeedLoader::OnGetAccountMetadata, 294 base::Bind(&GDataWapiFeedLoader::OnGetAccountMetadata,
293 weak_ptr_factory_.GetWeakPtr(), 295 weak_ptr_factory_.GetWeakPtr(),
294 initial_origin, 296 initial_origin,
295 local_changestamp, 297 local_changestamp,
296 callback)); 298 callback));
297 } 299 }
298 300
299 void GDataWapiFeedLoader::OnGetAccountMetadata( 301 void GDataWapiFeedLoader::OnGetAccountMetadata(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 450
449 void GDataWapiFeedLoader::LoadFromServer(const LoadFeedParams& params) { 451 void GDataWapiFeedLoader::LoadFromServer(const LoadFeedParams& params) {
450 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 452 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
451 453
452 // |feed_list| will contain the list of all collected feed updates that 454 // |feed_list| will contain the list of all collected feed updates that
453 // we will receive through calls of GDataWapiService::GetDocuments(). 455 // we will receive through calls of GDataWapiService::GetDocuments().
454 scoped_ptr<std::vector<DocumentFeed*> > feed_list( 456 scoped_ptr<std::vector<DocumentFeed*> > feed_list(
455 new std::vector<DocumentFeed*>); 457 new std::vector<DocumentFeed*>);
456 const base::TimeTicks start_time = base::TimeTicks::Now(); 458 const base::TimeTicks start_time = base::TimeTicks::Now();
457 459
460 #if 0
kochi 2012/08/21 05:09:23 Removed.
458 if (gdata::util::IsDriveV2ApiEnabled()) { 461 if (gdata::util::IsDriveV2ApiEnabled()) {
459 drive_service_->GetDocuments( 462 drive_service_->GetDocuments(
460 params.feed_to_load, 463 params.feed_to_load,
461 params.start_changestamp, 464 params.start_changestamp,
462 std::string(), // No search query. 465 std::string(), // No search query.
463 std::string(), // No directory resource ID. 466 std::string(), // No directory resource ID.
464 base::Bind(&GDataWapiFeedLoader::OnGetChangelist, 467 base::Bind(&GDataWapiFeedLoader::OnGetChangelist,
465 weak_ptr_factory_.GetWeakPtr(), 468 weak_ptr_factory_.GetWeakPtr(),
466 params.initial_origin, 469 params.initial_origin,
467 params.feed_load_callback, 470 params.feed_load_callback,
468 base::Owned(new GetDocumentsParams( 471 base::Owned(new GetDocumentsParams(
469 params.start_changestamp, 472 params.start_changestamp,
470 params.root_feed_changestamp, 473 params.root_feed_changestamp,
471 feed_list.release(), 474 feed_list.release(),
472 params.search_query, 475 params.search_query,
473 params.directory_resource_id, 476 params.directory_resource_id,
474 params.load_finished_callback, 477 params.load_finished_callback,
475 NULL)), 478 NULL)),
476 start_time)); 479 start_time));
477 return; 480 return;
478 } 481 }
482 #endif
479 483
480 drive_service_->GetDocuments( 484 drive_service_->GetDocuments(
481 params.feed_to_load, 485 params.feed_to_load,
482 params.start_changestamp, 486 params.start_changestamp,
483 params.search_query, 487 params.search_query,
484 params.directory_resource_id, 488 params.directory_resource_id,
485 base::Bind(&GDataWapiFeedLoader::OnGetDocuments, 489 base::Bind(&GDataWapiFeedLoader::OnGetDocuments,
486 weak_ptr_factory_.GetWeakPtr(), 490 weak_ptr_factory_.GetWeakPtr(),
487 params.initial_origin, 491 params.initial_origin,
488 params.feed_load_callback, 492 params.feed_load_callback,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // Currently the UI update is stopped. Start UI periodic callback. 741 // Currently the UI update is stopped. Start UI periodic callback.
738 MessageLoop::current()->PostTask( 742 MessageLoop::current()->PostTask(
739 FROM_HERE, 743 FROM_HERE,
740 base::Bind(&GDataWapiFeedLoader::OnNotifyDocumentFeedFetched, 744 base::Bind(&GDataWapiFeedLoader::OnNotifyDocumentFeedFetched,
741 weak_ptr_factory_.GetWeakPtr(), 745 weak_ptr_factory_.GetWeakPtr(),
742 ui_state->weak_ptr_factory.GetWeakPtr())); 746 ui_state->weak_ptr_factory.GetWeakPtr()));
743 } 747 }
744 ui_state->num_fetched_documents = num_accumulated_entries; 748 ui_state->num_fetched_documents = num_accumulated_entries;
745 ui_state->feed_fetching_elapsed_time = base::TimeTicks::Now() - start_time; 749 ui_state->feed_fetching_elapsed_time = base::TimeTicks::Now() - start_time;
746 750
751 #if 0
kochi 2012/08/21 05:09:23 Removed.
747 // Kick off the remaining part of the feeds. 752 // Kick off the remaining part of the feeds.
748 drive_service_->GetDocuments( 753 drive_service_->GetDocuments(
749 current_feed->next_link(), 754 current_feed->next_link(),
750 params->start_changestamp, 755 params->start_changestamp,
751 std::string(), // No search query. 756 std::string(), // No search query.
752 std::string(), // No directory resource ID. 757 std::string(), // No directory resource ID.
753 base::Bind(&GDataWapiFeedLoader::OnGetChangelist, 758 base::Bind(&GDataWapiFeedLoader::OnGetChangelist,
754 weak_ptr_factory_.GetWeakPtr(), 759 weak_ptr_factory_.GetWeakPtr(),
755 initial_origin, 760 initial_origin,
756 callback, 761 callback,
757 base::Owned( 762 base::Owned(
758 new GetDocumentsParams( 763 new GetDocumentsParams(
759 params->start_changestamp, 764 params->start_changestamp,
760 params->root_feed_changestamp, 765 params->root_feed_changestamp,
761 params->feed_list.release(), 766 params->feed_list.release(),
762 params->search_query, 767 params->search_query,
763 params->directory_resource_id, 768 params->directory_resource_id,
764 params->callback, 769 params->callback,
765 NULL)), 770 NULL)),
766 start_time)); 771 start_time));
772 #endif
767 return; 773 return;
768 } 774 }
769 775
770 // Notify the observers that all document feeds are fetched. 776 // Notify the observers that all document feeds are fetched.
771 FOR_EACH_OBSERVER(Observer, observers_, 777 FOR_EACH_OBSERVER(Observer, observers_,
772 OnDocumentFeedFetched(num_accumulated_entries)); 778 OnDocumentFeedFetched(num_accumulated_entries));
773 779
774 UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime", 780 UMA_HISTOGRAM_TIMES("Drive.EntireFeedLoadTime",
775 base::TimeTicks::Now() - start_time); 781 base::TimeTicks::Now() - start_time);
776 782
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 dir_iter != changed_dirs.end(); ++dir_iter) { 963 dir_iter != changed_dirs.end(); ++dir_iter) {
958 FOR_EACH_OBSERVER(Observer, observers_, 964 FOR_EACH_OBSERVER(Observer, observers_,
959 OnDirectoryChanged(*dir_iter)); 965 OnDirectoryChanged(*dir_iter));
960 } 966 }
961 } 967 }
962 968
963 return error; 969 return error;
964 } 970 }
965 971
966 } // namespace gdata 972 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698