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