| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 const std::vector<int64_t> MaybeGetOfflineIdsForClientId( | 143 const std::vector<int64_t> MaybeGetOfflineIdsForClientId( |
| 144 const ClientId& client_id) const; | 144 const ClientId& client_id) const; |
| 145 void GetPagesByOnlineURLWhenLoadDone( | 145 void GetPagesByOnlineURLWhenLoadDone( |
| 146 const GURL& online_url, | 146 const GURL& online_url, |
| 147 const MultipleOfflinePageItemCallback& callback) const; | 147 const MultipleOfflinePageItemCallback& callback) const; |
| 148 void MarkPageAccessedWhenLoadDone(int64_t offline_id); | 148 void MarkPageAccessedWhenLoadDone(int64_t offline_id); |
| 149 | 149 |
| 150 void CheckMetadataConsistency(); | 150 void CheckMetadataConsistency(); |
| 151 | 151 |
| 152 // Callback for loading pages from the offline page metadata store. | 152 // Callback for loading pages from the offline page metadata store. |
| 153 void OnStoreInitialized(const base::TimeTicks& start_time, StoreState state); |
| 153 void OnLoadDone(const base::TimeTicks& start_time, | 154 void OnLoadDone(const base::TimeTicks& start_time, |
| 154 OfflinePageMetadataStore::LoadStatus load_status, | |
| 155 const std::vector<OfflinePageItem>& offline_pages); | 155 const std::vector<OfflinePageItem>& offline_pages); |
| 156 void CompleteLoad(); |
| 156 | 157 |
| 157 // Steps for saving a page offline. | 158 // Steps for saving a page offline. |
| 158 void OnCreateArchiveDone(const GURL& requested_url, | 159 void OnCreateArchiveDone(const GURL& requested_url, |
| 159 int64_t offline_id, | 160 int64_t offline_id, |
| 160 const ClientId& client_id, | 161 const ClientId& client_id, |
| 161 const base::Time& start_time, | 162 const base::Time& start_time, |
| 162 const SavePageCallback& callback, | 163 const SavePageCallback& callback, |
| 163 OfflinePageArchiver* archiver, | 164 OfflinePageArchiver* archiver, |
| 164 OfflinePageArchiver::ArchiverResult result, | 165 OfflinePageArchiver::ArchiverResult result, |
| 165 const GURL& url, | 166 const GURL& url, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 236 |
| 236 // Clears expired pages if there are any. | 237 // Clears expired pages if there are any. |
| 237 void ClearStorageIfNeeded( | 238 void ClearStorageIfNeeded( |
| 238 const OfflinePageStorageManager::ClearStorageCallback& callback); | 239 const OfflinePageStorageManager::ClearStorageCallback& callback); |
| 239 | 240 |
| 240 // Callback completing storage clearing. | 241 // Callback completing storage clearing. |
| 241 void OnStorageCleared(size_t expired_page_count, | 242 void OnStorageCleared(size_t expired_page_count, |
| 242 OfflinePageStorageManager::ClearStorageResult result); | 243 OfflinePageStorageManager::ClearStorageResult result); |
| 243 | 244 |
| 244 // Post task to clear storage. | 245 // Post task to clear storage. |
| 245 void PostClearStorageIfNeededTask(); | 246 void PostClearStorageIfNeededTask(bool delayed); |
| 246 | 247 |
| 247 // Check if |offline_page| should be removed on cache reset by user. | 248 // Check if |offline_page| should be removed on cache reset by user. |
| 248 bool IsRemovedOnCacheReset(const OfflinePageItem& offline_page) const; | 249 bool IsRemovedOnCacheReset(const OfflinePageItem& offline_page) const; |
| 249 | 250 |
| 250 void RunWhenLoaded(const base::Closure& job); | 251 void RunWhenLoaded(const base::Closure& job); |
| 251 | 252 |
| 252 base::Time GetCurrentTime() const; | 253 base::Time GetCurrentTime() const; |
| 253 | 254 |
| 254 // Persistent store for offline page metadata. | 255 // Persistent store for offline page metadata. |
| 255 std::unique_ptr<OfflinePageMetadataStore> store_; | 256 std::unique_ptr<OfflinePageMetadataStore> store_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 base::Clock* testing_clock_; | 290 base::Clock* testing_clock_; |
| 290 | 291 |
| 291 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 292 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
| 292 | 293 |
| 293 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 294 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
| 294 }; | 295 }; |
| 295 | 296 |
| 296 } // namespace offline_pages | 297 } // namespace offline_pages |
| 297 | 298 |
| 298 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 299 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
| OLD | NEW |