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/offline_page_suggestions_provide
r.h" | 5 #include "components/ntp_snippets/offline_pages/offline_page_suggestions_provide
r.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 dismissed_ids.insert(offline_page_id); | 140 dismissed_ids.insert(offline_page_id); |
141 StoreDismissedIDsToPrefs(category, dismissed_ids); | 141 StoreDismissedIDsToPrefs(category, dismissed_ids); |
142 } | 142 } |
143 | 143 |
144 void OfflinePageSuggestionsProvider::FetchSuggestionImage( | 144 void OfflinePageSuggestionsProvider::FetchSuggestionImage( |
145 const std::string& suggestion_id, | 145 const std::string& suggestion_id, |
146 const ImageFetchedCallback& callback) { | 146 const ImageFetchedCallback& callback) { |
147 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available | 147 // TODO(pke): Fetch proper thumbnail from OfflinePageModel once it's available |
148 // there. | 148 // there. |
149 base::ThreadTaskRunnerHandle::Get()->PostTask( | 149 base::ThreadTaskRunnerHandle::Get()->PostTask( |
150 FROM_HERE, base::Bind(callback, suggestion_id, gfx::Image())); | 150 FROM_HERE, base::Bind(callback, gfx::Image())); |
151 } | 151 } |
152 | 152 |
153 void OfflinePageSuggestionsProvider::ClearCachedSuggestions(Category category) { | 153 void OfflinePageSuggestionsProvider::ClearCachedSuggestions(Category category) { |
154 // Ignored. | 154 // Ignored. |
155 } | 155 } |
156 | 156 |
157 void OfflinePageSuggestionsProvider::GetDismissedSuggestionsForDebugging( | 157 void OfflinePageSuggestionsProvider::GetDismissedSuggestionsForDebugging( |
158 Category category, | 158 Category category, |
159 const DismissedSuggestionsCallback& callback) { | 159 const DismissedSuggestionsCallback& callback) { |
160 offline_page_model_->GetAllPages( | 160 offline_page_model_->GetAllPages( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 void OfflinePageSuggestionsProvider::StoreDismissedIDsToPrefs( | 376 void OfflinePageSuggestionsProvider::StoreDismissedIDsToPrefs( |
377 Category category, | 377 Category category, |
378 const std::set<std::string>& dismissed_ids) { | 378 const std::set<std::string>& dismissed_ids) { |
379 base::ListValue list; | 379 base::ListValue list; |
380 for (const std::string& dismissed_id : dismissed_ids) | 380 for (const std::string& dismissed_id : dismissed_ids) |
381 list.AppendString(dismissed_id); | 381 list.AppendString(dismissed_id); |
382 pref_service_->Set(GetDismissedPref(category), list); | 382 pref_service_->Set(GetDismissedPref(category), list); |
383 } | 383 } |
384 | 384 |
385 } // namespace ntp_snippets | 385 } // namespace ntp_snippets |
OLD | NEW |