OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/ntp_snippets/ntp_snippets_service.h" | 5 #include "components/ntp_snippets/ntp_snippets_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 void NTPSnippetsService::FetchSnippetsFromHosts( | 259 void NTPSnippetsService::FetchSnippetsFromHosts( |
260 const std::set<std::string>& hosts, | 260 const std::set<std::string>& hosts, |
261 bool interactive_request) { | 261 bool interactive_request) { |
262 if (!ready()) | 262 if (!ready()) |
263 return; | 263 return; |
264 | 264 |
265 if (snippets_.empty()) | 265 if (snippets_.empty()) |
266 UpdateCategoryStatus(CategoryStatus::AVAILABLE_LOADING); | 266 UpdateCategoryStatus(CategoryStatus::AVAILABLE_LOADING); |
267 | 267 |
268 snippets_fetcher_->FetchSnippetsFromHosts( | 268 std::set<std::string> excluded_ids; |
269 hosts, application_language_code_, kMaxSnippetCount, interactive_request); | 269 for (const auto& snippet : dismissed_snippets_) { |
| 270 excluded_ids.insert(snippet->id()); |
| 271 } |
| 272 snippets_fetcher_->FetchSnippetsFromHosts(hosts, application_language_code_, |
| 273 excluded_ids, kMaxSnippetCount, |
| 274 interactive_request); |
270 } | 275 } |
271 | 276 |
272 void NTPSnippetsService::RescheduleFetching() { | 277 void NTPSnippetsService::RescheduleFetching() { |
273 // The scheduler only exists on Android so far, it's null on other platforms. | 278 // The scheduler only exists on Android so far, it's null on other platforms. |
274 if (!scheduler_) | 279 if (!scheduler_) |
275 return; | 280 return; |
276 | 281 |
277 if (ready()) { | 282 if (ready()) { |
278 base::Time now = base::Time::Now(); | 283 base::Time now = base::Time::Now(); |
279 scheduler_->Schedule( | 284 scheduler_->Schedule( |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { | 892 void NTPSnippetsService::UpdateCategoryStatus(CategoryStatus status) { |
888 if (status == category_status_) | 893 if (status == category_status_) |
889 return; | 894 return; |
890 | 895 |
891 category_status_ = status; | 896 category_status_ = status; |
892 observer()->OnCategoryStatusChanged(this, provided_category_, | 897 observer()->OnCategoryStatusChanged(this, provided_category_, |
893 category_status_); | 898 category_status_); |
894 } | 899 } |
895 | 900 |
896 } // namespace ntp_snippets | 901 } // namespace ntp_snippets |
OLD | NEW |