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..87fc372dd382e9894cc7398195ee2692a153c440 100644 |
| --- a/components/suggestions/suggestions_service.cc |
| +++ b/components/suggestions/suggestions_service.cc |
| @@ -156,8 +156,20 @@ bool SuggestionsService::IsControlGroup() { |
| } |
| void SuggestionsService::FetchSuggestionsData( |
| + SyncState sync_state, |
| SuggestionsService::ResponseCallback callback) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| + if (sync_state == NOT_INITIALIZED_ENABLED) { |
| + // Sync is not initialized yet, but enabled. Serve previously cached |
| + // suggestions if available. |
| + waiting_requestors_.push_back(callback); |
| + ServeFromCache(); |
| + return; |
| + } else if (sync_state == DISABLED) { |
| + suggestions_store_->ClearSuggestions(); |
|
manzagop (departed)
2014/08/20 15:43:51
Also cancel any ongoing request and serve the wait
Mathieu
2014/08/20 18:41:29
We shouldn't interact with the server anymore when
|
| + callback.Run(SuggestionsProfile()); |
| + return; |
| + } |
| FetchSuggestionsDataNoTimeout(callback); |