| 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/remote/remote_suggestions_provider_impl.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_provider_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 void RemoteSuggestionsProviderImpl::RefetchInTheBackground( | 332 void RemoteSuggestionsProviderImpl::RefetchInTheBackground( |
| 333 const FetchStatusCallback& callback) { | 333 const FetchStatusCallback& callback) { |
| 334 FetchSuggestions(/*interactive_request=*/false, callback); | 334 FetchSuggestions(/*interactive_request=*/false, callback); |
| 335 } | 335 } |
| 336 | 336 |
| 337 const RemoteSuggestionsFetcher* | 337 const RemoteSuggestionsFetcher* |
| 338 RemoteSuggestionsProviderImpl::suggestions_fetcher_for_debugging() const { | 338 RemoteSuggestionsProviderImpl::suggestions_fetcher_for_debugging() const { |
| 339 return suggestions_fetcher_.get(); | 339 return suggestions_fetcher_.get(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 GURL RemoteSuggestionsProviderImpl::GetUrlWithFavicon( |
| 343 const ContentSuggestion::ID& suggestion_id) const { |
| 344 DCHECK(base::ContainsKey(category_contents_, suggestion_id.category())); |
| 345 |
| 346 const CategoryContent& content = |
| 347 category_contents_.at(suggestion_id.category()); |
| 348 const RemoteSuggestion* suggestion = |
| 349 content.FindSuggestion(suggestion_id.id_within_category()); |
| 350 if (!suggestion) { |
| 351 return GURL(); |
| 352 } |
| 353 return ContentSuggestion::GetFaviconDomain(suggestion->url()); |
| 354 } |
| 355 |
| 342 void RemoteSuggestionsProviderImpl::FetchSuggestions( | 356 void RemoteSuggestionsProviderImpl::FetchSuggestions( |
| 343 bool interactive_request, | 357 bool interactive_request, |
| 344 const FetchStatusCallback& callback) { | 358 const FetchStatusCallback& callback) { |
| 345 if (!ready()) { | 359 if (!ready()) { |
| 346 fetch_when_ready_ = true; | 360 fetch_when_ready_ = true; |
| 347 fetch_when_ready_interactive_ = interactive_request; | 361 fetch_when_ready_interactive_ = interactive_request; |
| 348 fetch_when_ready_callback_ = callback; | 362 fetch_when_ready_callback_ = callback; |
| 349 return; | 363 return; |
| 350 } | 364 } |
| 351 | 365 |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( | 1291 RemoteSuggestionsProviderImpl::CategoryContent::CategoryContent( |
| 1278 CategoryContent&&) = default; | 1292 CategoryContent&&) = default; |
| 1279 | 1293 |
| 1280 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default; | 1294 RemoteSuggestionsProviderImpl::CategoryContent::~CategoryContent() = default; |
| 1281 | 1295 |
| 1282 RemoteSuggestionsProviderImpl::CategoryContent& | 1296 RemoteSuggestionsProviderImpl::CategoryContent& |
| 1283 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) = | 1297 RemoteSuggestionsProviderImpl::CategoryContent::operator=(CategoryContent&&) = |
| 1284 default; | 1298 default; |
| 1285 | 1299 |
| 1286 } // namespace ntp_snippets | 1300 } // namespace ntp_snippets |
| OLD | NEW |