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 14 matching lines...) Expand all Loading... |
25 #include "base/optional.h" | 25 #include "base/optional.h" |
26 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
28 #include "components/keyed_service/core/keyed_service.h" | 28 #include "components/keyed_service/core/keyed_service.h" |
29 #include "components/offline_pages/offline_page_archiver.h" | 29 #include "components/offline_pages/offline_page_archiver.h" |
30 #include "components/offline_pages/offline_page_metadata_store.h" | 30 #include "components/offline_pages/offline_page_metadata_store.h" |
31 #include "components/offline_pages/offline_page_model.h" | 31 #include "components/offline_pages/offline_page_model.h" |
32 #include "components/offline_pages/offline_page_model_event_logger.h" | 32 #include "components/offline_pages/offline_page_model_event_logger.h" |
33 #include "components/offline_pages/offline_page_storage_manager.h" | 33 #include "components/offline_pages/offline_page_storage_manager.h" |
34 #include "components/offline_pages/offline_page_types.h" | 34 #include "components/offline_pages/offline_page_types.h" |
| 35 #include "components/offline_pages/offline_store_types.h" |
35 | 36 |
36 class GURL; | 37 class GURL; |
37 namespace base { | 38 namespace base { |
38 class Clock; | 39 class Clock; |
39 class SequencedTaskRunner; | 40 class SequencedTaskRunner; |
40 class TimeDelta; | 41 class TimeDelta; |
41 class TimeTicks; | 42 class TimeTicks; |
42 } // namespace base | 43 } // namespace base |
43 | 44 |
44 namespace offline_pages { | 45 namespace offline_pages { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void InformSavePageDone(const SavePageCallback& callback, | 184 void InformSavePageDone(const SavePageCallback& callback, |
184 SavePageResult result, | 185 SavePageResult result, |
185 const ClientId& client_id, | 186 const ClientId& client_id, |
186 int64_t offline_id); | 187 int64_t offline_id); |
187 void DeletePendingArchiver(OfflinePageArchiver* archiver); | 188 void DeletePendingArchiver(OfflinePageArchiver* archiver); |
188 | 189 |
189 // Steps for deleting files and data for an offline page. | 190 // Steps for deleting files and data for an offline page. |
190 void OnDeleteArchiveFilesDone(const std::vector<int64_t>& offline_ids, | 191 void OnDeleteArchiveFilesDone(const std::vector<int64_t>& offline_ids, |
191 const DeletePageCallback& callback, | 192 const DeletePageCallback& callback, |
192 bool success); | 193 bool success); |
193 void OnRemoveOfflinePagesDone(const DeletePageCallback& callback, | 194 void OnRemoveOfflinePagesDone( |
194 std::unique_ptr<StoreUpdateResult> result); | 195 const DeletePageCallback& callback, |
| 196 std::unique_ptr<OfflinePagesUpdateResult> result); |
195 void InformDeletePageDone(const DeletePageCallback& callback, | 197 void InformDeletePageDone(const DeletePageCallback& callback, |
196 DeletePageResult result); | 198 DeletePageResult result); |
197 | 199 |
198 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item, | 200 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item, |
199 std::unique_ptr<StoreUpdateResult> result); | 201 std::unique_ptr<OfflinePagesUpdateResult> result); |
200 | 202 |
201 // Callbacks for checking metadata consistency. | 203 // Callbacks for checking metadata consistency. |
202 void CheckMetadataConsistencyForArchivePaths( | 204 void CheckMetadataConsistencyForArchivePaths( |
203 const std::set<base::FilePath>& archive_paths); | 205 const std::set<base::FilePath>& archive_paths); |
204 // Callback called after headless archives deleted. Orphaned archives are | 206 // Callback called after headless archives deleted. Orphaned archives are |
205 // archives files on disk which are not pointed to by any of the page items | 207 // archives files on disk which are not pointed to by any of the page items |
206 // in metadata store. | 208 // in metadata store. |
207 void ExpirePagesMissingArchiveFile( | 209 void ExpirePagesMissingArchiveFile( |
208 const std::set<base::FilePath>& archive_paths); | 210 const std::set<base::FilePath>& archive_paths); |
209 void OnExpirePagesMissingArchiveFileDone( | 211 void OnExpirePagesMissingArchiveFileDone( |
(...skipping 25 matching lines...) Expand all Loading... |
235 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 237 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
236 const DeletePageCallback& callback); | 238 const DeletePageCallback& callback); |
237 | 239 |
238 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and | 240 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and |
239 // requires that the model is loaded. | 241 // requires that the model is loaded. |
240 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, | 242 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, |
241 const DeletePageCallback& callback); | 243 const DeletePageCallback& callback); |
242 | 244 |
243 // Callback completing page expiration. | 245 // Callback completing page expiration. |
244 void OnExpirePageDone(const base::Time& expiration_time, | 246 void OnExpirePageDone(const base::Time& expiration_time, |
245 std::unique_ptr<StoreUpdateResult> result); | 247 std::unique_ptr<OfflinePagesUpdateResult> result); |
246 | 248 |
247 // Clears expired pages if there are any. | 249 // Clears expired pages if there are any. |
248 void ClearStorageIfNeeded( | 250 void ClearStorageIfNeeded( |
249 const OfflinePageStorageManager::ClearStorageCallback& callback); | 251 const OfflinePageStorageManager::ClearStorageCallback& callback); |
250 | 252 |
251 // Callback completing storage clearing. | 253 // Callback completing storage clearing. |
252 void OnStorageCleared(size_t expired_page_count, | 254 void OnStorageCleared(size_t expired_page_count, |
253 OfflinePageStorageManager::ClearStorageResult result); | 255 OfflinePageStorageManager::ClearStorageResult result); |
254 | 256 |
255 // Post task to clear storage. | 257 // Post task to clear storage. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 base::Clock* testing_clock_; | 302 base::Clock* testing_clock_; |
301 | 303 |
302 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 304 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
303 | 305 |
304 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 306 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
305 }; | 307 }; |
306 | 308 |
307 } // namespace offline_pages | 309 } // namespace offline_pages |
308 | 310 |
309 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 311 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
OLD | NEW |