| Index: components/ntp_snippets/ntp_snippets_fetcher.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| index c0018e7d816ad650ff06f25bdf664b5b64034e2e..f7177584effad68c34d9b5c81b38a7d04b81dbee 100644
|
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| @@ -216,6 +216,7 @@ void NTPSnippetsFetcher::SetCallback(
|
| void NTPSnippetsFetcher::FetchSnippetsFromHosts(
|
| const std::set<std::string>& hosts,
|
| const std::string& language_code,
|
| + const std::set<std::string>& excluded_ids,
|
| int count,
|
| bool interactive_request) {
|
| if (!request_throttler_.DemandQuotaForRequest(interactive_request))
|
| @@ -223,6 +224,7 @@ void NTPSnippetsFetcher::FetchSnippetsFromHosts(
|
|
|
| hosts_ = hosts;
|
| fetch_start_time_ = tick_clock_->NowTicks();
|
| + excluded_ids_ = excluded_ids;
|
|
|
| if (UsesHostRestrictions() && hosts_.empty()) {
|
| FetchFinished(OptionalSnippets(), FetchResult::EMPTY_HOSTS,
|
| @@ -317,12 +319,19 @@ std::string NTPSnippetsFetcher::RequestParams::BuildRequest() {
|
| if (!user_locale.empty()) {
|
| request->SetString("uiLanguage", user_locale);
|
| }
|
| +
|
| auto regular_hosts = base::MakeUnique<base::ListValue>();
|
| for (const auto& host : host_restricts) {
|
| regular_hosts->AppendString(host);
|
| }
|
| request->Set("regularlyVisitedHostNames", std::move(regular_hosts));
|
|
|
| + auto excluded = base::MakeUnique<base::ListValue>();
|
| + for (const auto& id : excluded_ids) {
|
| + excluded->AppendString(id);
|
| + }
|
| + request->Set("excludedSuggestionIds", std::move(excluded));
|
| +
|
| // TODO(sfiera): support authentication and personalization
|
| // TODO(sfiera): support count_to_fetch
|
| break;
|
| @@ -392,6 +401,7 @@ void NTPSnippetsFetcher::FetchSnippetsNonAuthenticated() {
|
| params.fetch_api = fetch_api_;
|
| params.host_restricts =
|
| UsesHostRestrictions() ? hosts_ : std::set<std::string>();
|
| + params.excluded_ids = excluded_ids_;
|
| params.count_to_fetch = count_to_fetch_;
|
| FetchSnippetsImpl(url, std::string(), params.BuildRequest());
|
| }
|
| @@ -407,6 +417,7 @@ void NTPSnippetsFetcher::FetchSnippetsAuthenticated(
|
| params.user_locale = locale_;
|
| params.host_restricts =
|
| UsesHostRestrictions() ? hosts_ : std::set<std::string>();
|
| + params.excluded_ids = excluded_ids_;
|
| params.count_to_fetch = count_to_fetch_;
|
| // TODO(jkrcal, treib): Add unit-tests for authenticated fetches.
|
| FetchSnippetsImpl(fetch_url_,
|
|
|