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