| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 continue; | 176 continue; |
| 177 | 177 |
| 178 suggestions.push_back(ConvertOfflinePage(item)); | 178 suggestions.push_back(ConvertOfflinePage(item)); |
| 179 } | 179 } |
| 180 callback.Run(std::move(suggestions)); | 180 callback.Run(std::move(suggestions)); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void RecentTabSuggestionsProvider::OfflinePageModelLoaded( | 183 void RecentTabSuggestionsProvider::OfflinePageModelLoaded( |
| 184 offline_pages::OfflinePageModel* model) {} | 184 offline_pages::OfflinePageModel* model) {} |
| 185 | 185 |
| 186 void RecentTabSuggestionsProvider::OfflinePageModelChanged( | 186 void RecentTabSuggestionsProvider::OfflinePageAdded( |
| 187 offline_pages::OfflinePageModel* model) { | 187 offline_pages::OfflinePageModel* model, |
| 188 const offline_pages::OfflinePageItem& added_page) { |
| 188 DCHECK_EQ(offline_page_model_, model); | 189 DCHECK_EQ(offline_page_model_, model); |
| 189 FetchRecentTabs(); | 190 FetchRecentTabs(); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void RecentTabSuggestionsProvider:: | 193 void RecentTabSuggestionsProvider:: |
| 193 GetPagesMatchingQueryCallbackForFetchRecentTabs( | 194 GetPagesMatchingQueryCallbackForFetchRecentTabs( |
| 194 const std::vector<OfflinePageItem>& offline_pages) { | 195 const std::vector<OfflinePageItem>& offline_pages) { |
| 195 NotifyStatusChanged(CategoryStatus::AVAILABLE); | 196 NotifyStatusChanged(CategoryStatus::AVAILABLE); |
| 196 std::set<std::string> old_dismissed_ids = ReadDismissedIDsFromPrefs(); | 197 std::set<std::string> old_dismissed_ids = ReadDismissedIDsFromPrefs(); |
| 197 std::set<std::string> new_dismissed_ids; | 198 std::set<std::string> new_dismissed_ids; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 292 } |
| 292 | 293 |
| 293 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 294 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 294 const std::set<std::string>& dismissed_ids) { | 295 const std::set<std::string>& dismissed_ids) { |
| 295 prefs::StoreDismissedIDsToPrefs(pref_service_, | 296 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 296 prefs::kDismissedRecentOfflineTabSuggestions, | 297 prefs::kDismissedRecentOfflineTabSuggestions, |
| 297 dismissed_ids); | 298 dismissed_ids); |
| 298 } | 299 } |
| 299 | 300 |
| 300 } // namespace ntp_snippets | 301 } // namespace ntp_snippets |
| OLD | NEW |