| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // in metadata store. | 201 // in metadata store. |
| 202 void ExpirePagesMissingArchiveFile( | 202 void ExpirePagesMissingArchiveFile( |
| 203 const std::set<base::FilePath>& archive_paths); | 203 const std::set<base::FilePath>& archive_paths); |
| 204 void OnExpirePagesMissingArchiveFileDone( | 204 void OnExpirePagesMissingArchiveFileDone( |
| 205 const std::vector<int64_t>& offline_ids, | 205 const std::vector<int64_t>& offline_ids, |
| 206 bool success); | 206 bool success); |
| 207 void DeleteOrphanedArchives(const std::set<base::FilePath>& archive_paths); | 207 void DeleteOrphanedArchives(const std::set<base::FilePath>& archive_paths); |
| 208 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives, | 208 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives, |
| 209 bool success); | 209 bool success); |
| 210 | 210 |
| 211 // Callbacks for deleting pages with same URL when saving pages. |
| 212 void OnPagesFoundWithSameURL(const ClientId& client_id, |
| 213 int64_t offline_id, |
| 214 size_t pages_allowed, |
| 215 const MultipleOfflinePageItemResult& items); |
| 216 void OnDeleteOldPagesWithSameURL(DeletePageResult result); |
| 217 |
| 211 // Steps for clearing all. | 218 // Steps for clearing all. |
| 212 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback, | 219 void OnRemoveAllFilesDoneForClearAll(const base::Closure& callback, |
| 213 DeletePageResult result); | 220 DeletePageResult result); |
| 214 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success); | 221 void OnResetStoreDoneForClearAll(const base::Closure& callback, bool success); |
| 215 void OnReloadStoreDoneForClearAll( | 222 void OnReloadStoreDoneForClearAll( |
| 216 const base::Closure& callback, | 223 const base::Closure& callback, |
| 217 OfflinePageMetadataStore::LoadStatus load_status, | 224 OfflinePageMetadataStore::LoadStatus load_status, |
| 218 const std::vector<OfflinePageItem>& offline_pages); | 225 const std::vector<OfflinePageItem>& offline_pages); |
| 219 | 226 |
| 220 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); | 227 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 234 bool success); | 241 bool success); |
| 235 | 242 |
| 236 // Clears expired pages if there are any. | 243 // Clears expired pages if there are any. |
| 237 void ClearStorageIfNeeded( | 244 void ClearStorageIfNeeded( |
| 238 const OfflinePageStorageManager::ClearStorageCallback& callback); | 245 const OfflinePageStorageManager::ClearStorageCallback& callback); |
| 239 | 246 |
| 240 // Callback completing storage clearing. | 247 // Callback completing storage clearing. |
| 241 void OnStorageCleared(size_t expired_page_count, | 248 void OnStorageCleared(size_t expired_page_count, |
| 242 OfflinePageStorageManager::ClearStorageResult result); | 249 OfflinePageStorageManager::ClearStorageResult result); |
| 243 | 250 |
| 251 // Post task to clear storage. |
| 252 void PostClearStorageIfNeededTask(); |
| 253 |
| 244 void RunWhenLoaded(const base::Closure& job); | 254 void RunWhenLoaded(const base::Closure& job); |
| 245 | 255 |
| 246 // Persistent store for offline page metadata. | 256 // Persistent store for offline page metadata. |
| 247 std::unique_ptr<OfflinePageMetadataStore> store_; | 257 std::unique_ptr<OfflinePageMetadataStore> store_; |
| 248 | 258 |
| 249 // Location where all of the archive files will be stored. | 259 // Location where all of the archive files will be stored. |
| 250 base::FilePath archives_dir_; | 260 base::FilePath archives_dir_; |
| 251 | 261 |
| 252 // The observers. | 262 // The observers. |
| 253 base::ObserverList<Observer> observers_; | 263 base::ObserverList<Observer> observers_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 274 std::unique_ptr<ArchiveManager> archive_manager_; | 284 std::unique_ptr<ArchiveManager> archive_manager_; |
| 275 | 285 |
| 276 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 286 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
| 277 | 287 |
| 278 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 288 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
| 279 }; | 289 }; |
| 280 | 290 |
| 281 } // namespace offline_pages | 291 } // namespace offline_pages |
| 282 | 292 |
| 283 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 293 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
| OLD | NEW |