Chromium Code Reviews| 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); |