| 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.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 497 |
| 498 database_->DeleteSnippets(GetSnippetIDVector(content->snippets)); | 498 database_->DeleteSnippets(GetSnippetIDVector(content->snippets)); |
| 499 database_->DeleteImages(GetSnippetIDVector(content->snippets)); | 499 database_->DeleteImages(GetSnippetIDVector(content->snippets)); |
| 500 content->snippets.clear(); | 500 content->snippets.clear(); |
| 501 | 501 |
| 502 if (IsCategoryStatusAvailable(content->status)) { | 502 if (IsCategoryStatusAvailable(content->status)) { |
| 503 NotifyNewSuggestions(category, *content); | 503 NotifyNewSuggestions(category, *content); |
| 504 } | 504 } |
| 505 } | 505 } |
| 506 | 506 |
| 507 void RemoteSuggestionsProvider::OnSignInStateChanged() { |
| 508 // Make sure the status service is registered and we already initialised its |
| 509 // start state. |
| 510 if (!initialized()) { |
| 511 return; |
| 512 } |
| 513 |
| 514 snippets_status_service_->OnSignInStateChanged(); |
| 515 } |
| 516 |
| 507 void RemoteSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 517 void RemoteSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
| 508 Category category, | 518 Category category, |
| 509 const DismissedSuggestionsCallback& callback) { | 519 const DismissedSuggestionsCallback& callback) { |
| 510 auto content_it = category_contents_.find(category); | 520 auto content_it = category_contents_.find(category); |
| 511 DCHECK(content_it != category_contents_.end()); | 521 DCHECK(content_it != category_contents_.end()); |
| 512 callback.Run( | 522 callback.Run( |
| 513 ConvertToContentSuggestions(category, content_it->second.dismissed)); | 523 ConvertToContentSuggestions(category, content_it->second.dismissed)); |
| 514 } | 524 } |
| 515 | 525 |
| 516 void RemoteSuggestionsProvider::ClearDismissedSuggestionsForDebugging( | 526 void RemoteSuggestionsProvider::ClearDismissedSuggestionsForDebugging( |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 RemoteSuggestionsProvider::CategoryContent::CategoryContent(CategoryContent&&) = | 1346 RemoteSuggestionsProvider::CategoryContent::CategoryContent(CategoryContent&&) = |
| 1337 default; | 1347 default; |
| 1338 | 1348 |
| 1339 RemoteSuggestionsProvider::CategoryContent::~CategoryContent() = default; | 1349 RemoteSuggestionsProvider::CategoryContent::~CategoryContent() = default; |
| 1340 | 1350 |
| 1341 RemoteSuggestionsProvider::CategoryContent& | 1351 RemoteSuggestionsProvider::CategoryContent& |
| 1342 RemoteSuggestionsProvider::CategoryContent::operator=(CategoryContent&&) = | 1352 RemoteSuggestionsProvider::CategoryContent::operator=(CategoryContent&&) = |
| 1343 default; | 1353 default; |
| 1344 | 1354 |
| 1345 } // namespace ntp_snippets | 1355 } // namespace ntp_snippets |
| OLD | NEW |