| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 for (const OfflinePageItem& item : offline_pages) { | 198 for (const OfflinePageItem& item : offline_pages) { |
| 199 if (!dismissed_ids.count(base::IntToString(item.offline_id))) { | 199 if (!dismissed_ids.count(base::IntToString(item.offline_id))) { |
| 200 continue; | 200 continue; |
| 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( | |
| 209 offline_pages::OfflinePageModel* model) {} | |
| 210 | |
| 211 void RecentTabSuggestionsProvider::OfflinePageAdded( | 208 void RecentTabSuggestionsProvider::OfflinePageAdded( |
| 212 offline_pages::OfflinePageModel* model, | 209 offline_pages::OfflinePageModel* model, |
| 213 const offline_pages::OfflinePageItem& added_page) { | 210 const offline_pages::OfflinePageItem& added_page) { |
| 214 DCHECK_EQ(offline_page_model_, model); | 211 DCHECK_EQ(offline_page_model_, model); |
| 215 FetchRecentTabs(); | 212 FetchRecentTabs(); |
| 216 } | 213 } |
| 217 | 214 |
| 218 void RecentTabSuggestionsProvider:: | 215 void RecentTabSuggestionsProvider:: |
| 219 GetPagesMatchingQueryCallbackForFetchRecentTabs( | 216 GetPagesMatchingQueryCallbackForFetchRecentTabs( |
| 220 const std::vector<OfflinePageItem>& offline_pages) { | 217 const std::vector<OfflinePageItem>& offline_pages) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 334 } |
| 338 | 335 |
| 339 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( | 336 void RecentTabSuggestionsProvider::StoreDismissedIDsToPrefs( |
| 340 const std::set<std::string>& dismissed_ids) { | 337 const std::set<std::string>& dismissed_ids) { |
| 341 prefs::StoreDismissedIDsToPrefs(pref_service_, | 338 prefs::StoreDismissedIDsToPrefs(pref_service_, |
| 342 prefs::kDismissedRecentOfflineTabSuggestions, | 339 prefs::kDismissedRecentOfflineTabSuggestions, |
| 343 dismissed_ids); | 340 dismissed_ids); |
| 344 } | 341 } |
| 345 | 342 |
| 346 } // namespace ntp_snippets | 343 } // namespace ntp_snippets |
| OLD | NEW |