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

Unified Diff: chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc

Issue 1770843002: SuggestionsService: implement SyncServiceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix2 Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc
diff --git a/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc b/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc
index beb1fc8adeed5a073d7721d4a0b3cabb1e571385..6329248712dc6ee7e32d2b73386364e13b7f7ae2 100644
--- a/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/suggestions/suggestions_search_provider.cc
@@ -11,14 +11,12 @@
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
-#include "chrome/browser/search/suggestions/suggestions_utils.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/app_list/search/suggestions/url_suggestion_result.h"
#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/favicon/core/favicon_service.h"
#include "components/suggestions/proto/suggestions.pb.h"
#include "components/suggestions/suggestions_service.h"
-#include "components/suggestions/suggestions_utils.h"
namespace app_list {
@@ -41,26 +39,13 @@ SuggestionsSearchProvider::~SuggestionsSearchProvider() {
void SuggestionsSearchProvider::Start(bool /*is_voice_query*/,
const base::string16& query) {
ClearResults();
- // If the service is not enabled, do not return any results.
- if (!suggestions_service_)
- return;
// Only return suggestions on an empty query.
if (!query.empty())
return;
- // Suggestions service is enabled; initiate a query.
- suggestions_service_->FetchSuggestionsData(
- suggestions::GetSyncState(profile_),
- base::Bind(&SuggestionsSearchProvider::OnSuggestionsProfileAvailable,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void SuggestionsSearchProvider::Stop() {
-}
-
-void SuggestionsSearchProvider::OnSuggestionsProfileAvailable(
- const suggestions::SuggestionsProfile& suggestions_profile) {
+ const suggestions::SuggestionsProfile& suggestions_profile =
+ suggestions_service_->GetSuggestionsDataFromCache();
for (int i = 0; i < suggestions_profile.suggestions_size(); ++i) {
const suggestions::ChromeSuggestion& suggestion =
suggestions_profile.suggestions(i);
@@ -74,4 +59,7 @@ void SuggestionsSearchProvider::OnSuggestionsProfileAvailable(
}
}
+void SuggestionsSearchProvider::Stop() {
+}
+
} // namespace app_list

Powered by Google App Engine
This is Rietveld 408576698