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 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Implemented methods: | 67 // Implemented methods: |
68 void AddObserver(Observer* observer) override; | 68 void AddObserver(Observer* observer) override; |
69 void RemoveObserver(Observer* observer) override; | 69 void RemoveObserver(Observer* observer) override; |
70 void SavePage(const GURL& url, | 70 void SavePage(const GURL& url, |
71 const ClientId& client_id, | 71 const ClientId& client_id, |
72 int64_t proposed_offline_id, | 72 int64_t proposed_offline_id, |
73 std::unique_ptr<OfflinePageArchiver> archiver, | 73 std::unique_ptr<OfflinePageArchiver> archiver, |
74 const SavePageCallback& callback) override; | 74 const SavePageCallback& callback) override; |
75 void MarkPageAccessed(int64_t offline_id) override; | 75 void MarkPageAccessed(int64_t offline_id) override; |
76 void ClearAll(const base::Closure& callback) override; | |
77 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 76 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
78 const DeletePageCallback& callback) override; | 77 const DeletePageCallback& callback) override; |
79 void DeleteCachedPagesByURLPredicate( | 78 void DeleteCachedPagesByURLPredicate( |
80 const UrlPredicate& predicate, | 79 const UrlPredicate& predicate, |
81 const DeletePageCallback& callback) override; | 80 const DeletePageCallback& callback) override; |
82 void CheckPagesExistOffline( | 81 void CheckPagesExistOffline( |
83 const std::set<GURL>& urls, | 82 const std::set<GURL>& urls, |
84 const CheckPagesExistOfflineCallback& callback) override; | 83 const CheckPagesExistOfflineCallback& callback) override; |
85 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override; | 84 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override; |
86 void GetAllPagesWithExpired( | 85 void GetAllPagesWithExpired( |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives, | 214 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives, |
216 bool success); | 215 bool success); |
217 | 216 |
218 // Callbacks for deleting pages with same URL when saving pages. | 217 // Callbacks for deleting pages with same URL when saving pages. |
219 void DeleteExistingPagesWithSameURL(const OfflinePageItem& offline_page); | 218 void DeleteExistingPagesWithSameURL(const OfflinePageItem& offline_page); |
220 void OnPagesFoundWithSameURL(const OfflinePageItem& offline_page, | 219 void OnPagesFoundWithSameURL(const OfflinePageItem& offline_page, |
221 size_t pages_allowed, | 220 size_t pages_allowed, |
222 const MultipleOfflinePageItemResult& items); | 221 const MultipleOfflinePageItemResult& items); |
223 void OnDeleteOldPagesWithSameURL(DeletePageResult result); | 222 void OnDeleteOldPagesWithSameURL(DeletePageResult result); |
224 | 223 |
225 // Steps for clearing all. | |
226 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback, | |
227 DeletePageResult result); | |
228 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success); | |
229 void OnReloadStoreDoneForClearAll( | |
230 const base::Closure& callback, | |
231 OfflinePageMetadataStore::LoadStatus load_status, | |
232 const std::vector<OfflinePageItem>& offline_pages); | |
233 | |
234 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); | 224 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); |
235 | 225 |
236 // Actually does the work of deleting, requires the model is loaded. | 226 // Actually does the work of deleting, requires the model is loaded. |
237 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 227 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
238 const DeletePageCallback& callback); | 228 const DeletePageCallback& callback); |
239 | 229 |
240 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and | 230 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and |
241 // requires that the model is loaded. | 231 // requires that the model is loaded. |
242 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, | 232 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, |
243 const DeletePageCallback& callback); | 233 const DeletePageCallback& callback); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 base::Clock* testing_clock_; | 292 base::Clock* testing_clock_; |
303 | 293 |
304 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 294 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
305 | 295 |
306 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 296 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
307 }; | 297 }; |
308 | 298 |
309 } // namespace offline_pages | 299 } // namespace offline_pages |
310 | 300 |
311 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 301 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
OLD | NEW |