| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/offline_pages/recent_tab_suggestions_provider.
h" | 5 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 201 } |
| 202 | 202 |
| 203 suggestions.push_back(ConvertOfflinePage(item)); | 203 suggestions.push_back(ConvertOfflinePage(item)); |
| 204 } | 204 } |
| 205 callback.Run(std::move(suggestions)); | 205 callback.Run(std::move(suggestions)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void RecentTabSuggestionsProvider::OfflinePageModelLoaded( | 208 void RecentTabSuggestionsProvider::OfflinePageModelLoaded( |
| 209 offline_pages::OfflinePageModel* model) {} | 209 offline_pages::OfflinePageModel* model) {} |
| 210 | 210 |
| 211 void RecentTabSuggestionsProvider::OfflinePageModelChanged( | 211 void RecentTabSuggestionsProvider::OfflinePageAdded( |
| 212 offline_pages::OfflinePageModel* model) { | 212 offline_pages::OfflinePageModel* model, |
| 213 const offline_pages::OfflinePageItem& added_page) { |
| 213 DCHECK_EQ(offline_page_model_, model); | 214 DCHECK_EQ(offline_page_model_, model); |
| 214 FetchRecentTabs(); | 215 FetchRecentTabs(); |
| 215 } | 216 } |
| 216 | 217 |
| 217 void RecentTabSuggestionsProvider:: | 218 void RecentTabSuggestionsProvider:: |
| 218 GetPagesMatchingQueryCallbackForFetchRecentTabs( | 219 GetPagesMatchingQueryCallbackForFetchRecentTabs( |
| 219 const std::vector<OfflinePageItem>& offline_pages) { | 220 const std::vector<OfflinePageItem>& offline_pages) { |
| 220 NotifyStatusChanged(CategoryStatus::AVAILABLE); | 221 NotifyStatusChanged(CategoryStatus::AVAILABLE); |
| 221 std::set<std::string> old_dismissed_ids = ReadDismissedIDsFromPrefs(); | 222 std::set<std::string> old_dismissed_ids = ReadDismissedIDsFromPrefs(); |
| 222 std::set<std::string> new_dismissed_ids; | 223 std::set<std::string> new_dismissed_ids; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } | 337 } |
| 337 | 338 |
| 338 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 339 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 339 const std::set<std::string>& dismissed_ids) { | 340 const std::set<std::string>& dismissed_ids) { |
| 340 prefs::StoreDismissedIDsToPrefs(pref_service_, | 341 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 341 prefs::kDismissedRecentOfflineTabSuggestions, | 342 prefs::kDismissedRecentOfflineTabSuggestions, |
| 342 dismissed_ids); | 343 dismissed_ids); |
| 343 } | 344 } |
| 344 | 345 |
| 345 } // namespace ntp_snippets | 346 } // namespace ntp_snippets |
| OLD | NEW |