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

Unified Diff: components/suggestions/suggestions_service.cc

Issue 473123002: [Most Visited] Check for Sync state when using SuggestionsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean Created 6 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 side-by-side diff with in-line comments
Download patch
Index: components/suggestions/suggestions_service.cc
diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc
index db1e3fc9632156cf08337286ea1201c93acd7051..6c31f2827c9b45c8b5c2a7ee7e8a535678294e2d 100644
--- a/components/suggestions/suggestions_service.cc
+++ b/components/suggestions/suggestions_service.cc
@@ -156,8 +156,21 @@ bool SuggestionsService::IsControlGroup() {
}
void SuggestionsService::FetchSuggestionsData(
+ bool sync_initialized,
+ bool history_sync_enabled,
SuggestionsService::ResponseCallback callback) {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (!sync_initialized) {
+ // Serve from cache.
+ waiting_requestors_.push_back(callback);
+ ServeFromCache();
+ return;
+ } else if (!history_sync_enabled) {
+ // User hasn't enabled history sync.
+ callback.Run(SuggestionsProfile());
manzagop (departed) 2014/08/15 13:01:52 Why not clear the cache, then push back requestors
Mathieu 2014/08/20 14:21:32 Done.
+ return;
+ }
+ // Sync is initialized and history sync is enabled.
FetchSuggestionsDataNoTimeout(callback);

Powered by Google App Engine
This is Rietveld 408576698