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

Unified Diff: chrome/browser/search/instant_service.cc

Issue 1770843002: SuggestionsService: implement SyncServiceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iOS 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
« no previous file with comments | « chrome/browser/search/instant_service.h ('k') | chrome/browser/search/instant_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/instant_service.cc
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index fd75e1d25c124087f5a4088f8266b6f360ed2214..1089c788d13798a0c82642b02a8ad7186269f76f 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/search/search.h"
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
#include "chrome/browser/search/suggestions/suggestions_source.h"
-#include "chrome/browser/search/suggestions/suggestions_utils.h"
#include "chrome/browser/search/thumbnail_source.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
@@ -184,10 +183,11 @@ InstantService::InstantService(Profile* profile)
}
if (suggestions_service_) {
- suggestions_service_->FetchSuggestionsData(
- suggestions::GetSyncState(profile_),
+ suggestions_subscription_ = suggestions_service_->AddCallback(
base::Bind(&InstantService::OnSuggestionsAvailable,
- weak_ptr_factory_.GetWeakPtr()));
+ base::Unretained(this)));
+ suggestions_service_->FetchSuggestionsData();
+ // TODO(treib): Also re-fetch suggestions on local NTP loads.
}
}
@@ -225,12 +225,8 @@ void InstantService::DeleteMostVisitedItem(const GURL& url) {
if (top_sites)
top_sites->AddBlacklistedURL(url);
- if (suggestions_service_) {
- suggestions_service_->BlacklistURL(
- url, base::Bind(&InstantService::OnSuggestionsAvailable,
- weak_ptr_factory_.GetWeakPtr()),
- base::Closure());
- }
+ if (suggestions_service_)
+ suggestions_service_->BlacklistURL(url);
}
void InstantService::UndoMostVisitedDeletion(const GURL& url) {
@@ -239,12 +235,8 @@ void InstantService::UndoMostVisitedDeletion(const GURL& url) {
if (top_sites)
top_sites->RemoveBlacklistedURL(url);
- if (suggestions_service_) {
- suggestions_service_->UndoBlacklistURL(
- url, base::Bind(&InstantService::OnSuggestionsAvailable,
- weak_ptr_factory_.GetWeakPtr()),
- base::Closure());
- }
+ if (suggestions_service_)
+ suggestions_service_->UndoBlacklistURL(url);
}
void InstantService::UndoAllMostVisitedDeletions() {
@@ -253,11 +245,8 @@ void InstantService::UndoAllMostVisitedDeletions() {
if (top_sites)
top_sites->ClearBlacklistedURLs();
- if (suggestions_service_) {
- suggestions_service_->ClearBlacklist(
- base::Bind(&InstantService::OnSuggestionsAvailable,
- weak_ptr_factory_.GetWeakPtr()));
- }
+ if (suggestions_service_)
+ suggestions_service_->ClearBlacklist();
}
void InstantService::UpdateThemeInfo() {
« no previous file with comments | « chrome/browser/search/instant_service.h ('k') | chrome/browser/search/instant_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698