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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 OfflineEventLogger* GetLogger() override; | 113 OfflineEventLogger* GetLogger() override; |
114 | 114 |
115 protected: | 115 protected: |
116 // Adding a protected constructor for testing-only purposes in | 116 // Adding a protected constructor for testing-only purposes in |
117 // offline_page_storage_manager_unittest.cc | 117 // offline_page_storage_manager_unittest.cc |
118 OfflinePageModelImpl(); | 118 OfflinePageModelImpl(); |
119 | 119 |
120 private: | 120 private: |
121 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion); | 121 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion); |
122 | 122 |
123 enum class GetAllPageMode { | 123 enum class GetAllPageMode { |
fgorski
2016/10/26 18:05:41
remove?
dewittj
2016/10/27 22:49:17
Done.
| |
124 ALL, // Get all active page entries. | 124 ALL, // Get all active page entries. |
125 ALL_WITH_EXPIRED, // Get all pages entries including expired ones. | 125 ALL_WITH_EXPIRED, // Get all pages entries including expired ones. |
126 }; | 126 }; |
127 | 127 |
128 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; | 128 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; |
129 | 129 |
130 void ExecuteQuery(std::unique_ptr<OfflinePageModelQuery> query, | |
131 const MultipleOfflinePageItemCallback& callback); | |
132 | |
130 // Callback for ensuring archive directory is created. | 133 // Callback for ensuring archive directory is created. |
131 void OnEnsureArchivesDirCreatedDone(const base::TimeTicks& start_time); | 134 void OnEnsureArchivesDirCreatedDone(const base::TimeTicks& start_time); |
132 | 135 |
133 void GetAllPagesAfterLoadDone( | |
134 GetAllPageMode mode, | |
135 const MultipleOfflinePageItemCallback& callback) const; | |
136 void CheckPagesExistOfflineAfterLoadDone( | 136 void CheckPagesExistOfflineAfterLoadDone( |
137 const std::set<GURL>& urls, | 137 const std::set<GURL>& urls, |
138 const CheckPagesExistOfflineCallback& callback); | 138 const CheckPagesExistOfflineCallback& callback); |
139 void GetOfflineIdsForClientIdWhenLoadDone( | 139 void GetOfflineIdsForClientIdWhenLoadDone( |
140 const ClientId& client_id, | 140 const ClientId& client_id, |
141 const MultipleOfflineIdCallback& callback) const; | 141 const MultipleOfflineIdCallback& callback) const; |
142 void GetPageByOfflineIdWhenLoadDone( | 142 void GetPageByOfflineIdWhenLoadDone( |
143 int64_t offline_id, | 143 int64_t offline_id, |
144 const SingleOfflinePageItemCallback& callback) const; | 144 const SingleOfflinePageItemCallback& callback) const; |
145 const std::vector<int64_t> MaybeGetOfflineIdsForClientId( | 145 const std::vector<int64_t> MaybeGetOfflineIdsForClientId( |
146 const ClientId& client_id) const; | 146 const ClientId& client_id) const; |
147 const OfflinePageItem* MaybeGetPageByOfflineId(int64_t offline_id) const; | |
148 void GetPagesByOnlineURLWhenLoadDone( | 147 void GetPagesByOnlineURLWhenLoadDone( |
149 const GURL& online_url, | 148 const GURL& online_url, |
150 const MultipleOfflinePageItemCallback& callback) const; | 149 const MultipleOfflinePageItemCallback& callback) const; |
151 void MarkPageAccessedWhenLoadDone(int64_t offline_id); | 150 void MarkPageAccessedWhenLoadDone(int64_t offline_id); |
152 | 151 |
153 void CheckMetadataConsistency(); | 152 void CheckMetadataConsistency(); |
154 | 153 |
155 // Callback for loading pages from the offline page metadata store. | 154 // Callback for loading pages from the offline page metadata store. |
156 void OnLoadDone(const base::TimeTicks& start_time, | 155 void OnLoadDone(const base::TimeTicks& start_time, |
157 OfflinePageMetadataStore::LoadStatus load_status, | 156 OfflinePageMetadataStore::LoadStatus load_status, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 const MultipleOfflinePageItemResult& items); | 213 const MultipleOfflinePageItemResult& items); |
215 void OnDeleteOldPagesWithSameURL(DeletePageResult result); | 214 void OnDeleteOldPagesWithSameURL(DeletePageResult result); |
216 | 215 |
217 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); | 216 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); |
218 | 217 |
219 // Actually does the work of deleting, requires the model is loaded. | 218 // Actually does the work of deleting, requires the model is loaded. |
220 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 219 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
221 const DeletePageCallback& callback); | 220 const DeletePageCallback& callback); |
222 | 221 |
223 // Actually does the work of deleting, requires the model is loaded. | 222 // Actually does the work of deleting, requires the model is loaded. |
224 void DoDeletePagesByClientIds(const std::vector<ClientId>& client_ids, | 223 void DeletePages(const DeletePageCallback& callback, |
225 const DeletePageCallback& callback); | 224 const MultipleOfflinePageItemResult& items); |
226 | 225 |
227 void DoGetPagesByClientIds(const std::vector<ClientId>& client_ids, | 226 void DoGetPagesByClientIds(const std::vector<ClientId>& client_ids, |
228 const MultipleOfflinePageItemCallback& callback); | 227 const MultipleOfflinePageItemCallback& callback); |
229 | 228 |
230 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and | 229 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and |
231 // requires that the model is loaded. | 230 // requires that the model is loaded. |
232 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, | 231 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, |
233 const DeletePageCallback& callback); | 232 const DeletePageCallback& callback); |
234 | 233 |
235 // Callback completing page expiration. | 234 // Callback completing page expiration. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 base::Clock* testing_clock_; | 291 base::Clock* testing_clock_; |
293 | 292 |
294 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 293 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
295 | 294 |
296 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 295 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
297 }; | 296 }; |
298 | 297 |
299 } // namespace offline_pages | 298 } // namespace offline_pages |
300 | 299 |
301 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 300 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
OLD | NEW |