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

Unified Diff: chrome/browser/search/suggestions/suggestions_service.h

Issue 298703009: SuggestionsService blacklist handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address first round of comments. Avoid QueryMostVisited loop. Created 6 years, 7 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/search/suggestions/suggestions_service.h
diff --git a/chrome/browser/search/suggestions/suggestions_service.h b/chrome/browser/search/suggestions/suggestions_service.h
index 972cfce63ada136e3d84343cdcf43cd140f1c4e4..18afa66ea1e86d75eb5f7f35f43baeb722d8546a 100644
--- a/chrome/browser/search/suggestions/suggestions_service.h
+++ b/chrome/browser/search/suggestions/suggestions_service.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
#define CHROME_BROWSER_SEARCH_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
+#include <deque>
+#include <string>
#include <vector>
#include "base/basictypes.h"
@@ -23,6 +25,8 @@ namespace suggestions {
extern const char kSuggestionsFieldTrialName[];
extern const char kSuggestionsFieldTrialURLParam[];
+extern const char kSuggestionsFieldTrialSuggestionsSuffixParam[];
+extern const char kSuggestionsFieldTrialBlacklistSuffixParam[];
extern const char kSuggestionsFieldTrialStateParam[];
extern const char kSuggestionsFieldTrialStateEnabled[];
@@ -43,6 +47,11 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
// fetch request completes.
void FetchSuggestionsData(ResponseCallback callback);
+ // Issue a blacklist request. If there is already a blacklist request
+ // in-flight, the new blacklist request is ignored.
Jered 2014/05/27 22:33:17 nit: omit the - between in and flight
manzagop (departed) 2014/05/29 21:40:31 Done.
+ void AddBlacklistedURL(const GURL& candidate_url,
+ ResponseCallback callback);
+
private:
FRIEND_TEST_ALL_PREFIXES(SuggestionsServiceTest, FetchSuggestionsData);
@@ -54,6 +63,12 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
// KeyedService implementation.
virtual void Shutdown() OVERRIDE;
+ // Determines whether |request| is a blacklisting request.
+ bool IsBlacklistRequest(net::URLFetcher* request) const;
+
+ // Creates a request to the suggestions service, properly setting headers.
+ net::URLFetcher* CreateSuggestionsRequest(const GURL& url);
+
// Contains the current suggestions fetch request. Will only have a value
// while a request is pending, and will be reset by |OnURLFetchComplete|.
scoped_ptr<net::URLFetcher> pending_request_;
@@ -65,6 +80,9 @@ class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
// The URL to fetch suggestions data from.
GURL suggestions_url_;
+ // Prefix for building the blacklisting URL.
+ std::string blacklist_url_prefix_;
+
// Queue of callbacks. These are flushed when fetch request completes.
std::vector<ResponseCallback> waiting_requestors_;

Powered by Google App Engine
This is Rietveld 408576698