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 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 // Replace old snippets in |category| by newly available snippets. | 225 // Replace old snippets in |category| by newly available snippets. |
226 void ReplaceSnippets(Category category, NTPSnippet::PtrVector new_snippets); | 226 void ReplaceSnippets(Category category, NTPSnippet::PtrVector new_snippets); |
227 | 227 |
228 std::set<std::string> GetSnippetHostsFromPrefs() const; | 228 std::set<std::string> GetSnippetHostsFromPrefs() const; |
229 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts); | 229 void StoreSnippetHostsToPrefs(const std::set<std::string>& hosts); |
230 | 230 |
231 // Removes expired dismissed snippets from the service and the database. | 231 // Removes expired dismissed snippets from the service and the database. |
232 void ClearExpiredDismissedSnippets(); | 232 void ClearExpiredDismissedSnippets(); |
233 | 233 |
234 // Removes images from the DB that do not have any corresponding snippet | 234 // Removes images from the DB that do not have any corresponding snippet in |
235 // (neither in the current set, nor in the archived set). | 235 // the provided set. Needs to iterate the whole snippet database -- so do it |
236 void ClearOrphanedImages(); | 236 // often enough to keep it small but not too often as it still iterates over |
| 237 // the file system. |
| 238 void ClearOrphanedImages(const NTPSnippet::PtrVector& snippets); |
237 | 239 |
238 // Clears all stored snippets and updates the observer. | 240 // Clears all stored snippets and updates the observer. |
239 void NukeAllSnippets(); | 241 void NukeAllSnippets(); |
240 | 242 |
241 // Completes the initialization phase of the service, registering the last | 243 // Completes the initialization phase of the service, registering the last |
242 // observers. This is done after construction, once the database is loaded. | 244 // observers. This is done after construction, once the database is loaded. |
243 void FinishInitialization(); | 245 void FinishInitialization(); |
244 | 246 |
245 void OnSnippetImageFetchedFromDatabase( | 247 void OnSnippetImageFetchedFromDatabase( |
246 const ImageFetchedCallback& callback, | 248 const ImageFetchedCallback& callback, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 371 |
370 // Request throttler for limiting requests to thumbnail images. | 372 // Request throttler for limiting requests to thumbnail images. |
371 RequestThrottler thumbnail_requests_throttler_; | 373 RequestThrottler thumbnail_requests_throttler_; |
372 | 374 |
373 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); | 375 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); |
374 }; | 376 }; |
375 | 377 |
376 } // namespace ntp_snippets | 378 } // namespace ntp_snippets |
377 | 379 |
378 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 380 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
OLD | NEW |