| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return; | 483 return; |
| 484 | 484 |
| 485 database_->DeleteSnippets(GetSnippetIDVector(content->snippets)); | 485 database_->DeleteSnippets(GetSnippetIDVector(content->snippets)); |
| 486 database_->DeleteImages(GetSnippetIDVector(content->snippets)); | 486 database_->DeleteImages(GetSnippetIDVector(content->snippets)); |
| 487 content->snippets.clear(); | 487 content->snippets.clear(); |
| 488 | 488 |
| 489 if (IsCategoryStatusAvailable(content->status)) | 489 if (IsCategoryStatusAvailable(content->status)) |
| 490 NotifyNewSuggestions(category, *content); | 490 NotifyNewSuggestions(category, *content); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void RemoteSuggestionsProvider::OnSignInStateChanged() { |
| 494 // Make sure the status service is registered and we already initialised its |
| 495 // start state. |
| 496 if (!initialized()) { |
| 497 return; |
| 498 } |
| 499 |
| 500 snippets_status_service_->OnSignInStateChanged(); |
| 501 } |
| 502 |
| 493 void RemoteSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 503 void RemoteSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
| 494 Category category, | 504 Category category, |
| 495 const DismissedSuggestionsCallback& callback) { | 505 const DismissedSuggestionsCallback& callback) { |
| 496 auto content_it = category_contents_.find(category); | 506 auto content_it = category_contents_.find(category); |
| 497 DCHECK(content_it != category_contents_.end()); | 507 DCHECK(content_it != category_contents_.end()); |
| 498 callback.Run( | 508 callback.Run( |
| 499 ConvertToContentSuggestions(category, content_it->second.dismissed)); | 509 ConvertToContentSuggestions(category, content_it->second.dismissed)); |
| 500 } | 510 } |
| 501 | 511 |
| 502 void RemoteSuggestionsProvider::ClearDismissedSuggestionsForDebugging( | 512 void RemoteSuggestionsProvider::ClearDismissedSuggestionsForDebugging( |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 RemoteSuggestionsProvider::CategoryContent::CategoryContent(CategoryContent&&) = | 1315 RemoteSuggestionsProvider::CategoryContent::CategoryContent(CategoryContent&&) = |
| 1306 default; | 1316 default; |
| 1307 | 1317 |
| 1308 RemoteSuggestionsProvider::CategoryContent::~CategoryContent() = default; | 1318 RemoteSuggestionsProvider::CategoryContent::~CategoryContent() = default; |
| 1309 | 1319 |
| 1310 RemoteSuggestionsProvider::CategoryContent& | 1320 RemoteSuggestionsProvider::CategoryContent& |
| 1311 RemoteSuggestionsProvider::CategoryContent::operator=(CategoryContent&&) = | 1321 RemoteSuggestionsProvider::CategoryContent::operator=(CategoryContent&&) = |
| 1312 default; | 1322 default; |
| 1313 | 1323 |
| 1314 } // namespace ntp_snippets | 1324 } // namespace ntp_snippets |
| OLD | NEW |