| 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 21 matching lines...) Expand all Loading... |
| 32 #include "components/offline_pages/offline_page_types.h" | 32 #include "components/offline_pages/offline_page_types.h" |
| 33 | 33 |
| 34 class GURL; | 34 class GURL; |
| 35 namespace base { | 35 namespace base { |
| 36 class SequencedTaskRunner; | 36 class SequencedTaskRunner; |
| 37 class Time; | 37 class Time; |
| 38 class TimeDelta; | 38 class TimeDelta; |
| 39 class TimeTicks; | 39 class TimeTicks; |
| 40 } // namespace base | 40 } // namespace base |
| 41 | 41 |
| 42 namespace bookmarks { |
| 43 class BookmarkNode; |
| 44 } // namespace bookmarks |
| 45 |
| 42 namespace offline_pages { | 46 namespace offline_pages { |
| 43 | 47 |
| 44 static const int64_t kInvalidOfflineId = 0; | 48 static const int64_t kInvalidOfflineId = 0; |
| 45 | 49 |
| 46 struct ClientId; | 50 struct ClientId; |
| 47 struct OfflinePageItem; | 51 struct OfflinePageItem; |
| 48 | 52 |
| 49 class ArchiveManager; | 53 class ArchiveManager; |
| 50 class ClientPolicyController; | 54 class ClientPolicyController; |
| 51 class OfflinePageMetadataStore; | 55 class OfflinePageMetadataStore; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const MultipleOfflinePageItemCallback& callback) override; | 107 const MultipleOfflinePageItemCallback& callback) override; |
| 104 void GetBestPageForOnlineURL( | 108 void GetBestPageForOnlineURL( |
| 105 const GURL& online_url, | 109 const GURL& online_url, |
| 106 const SingleOfflinePageItemCallback callback) override; | 110 const SingleOfflinePageItemCallback callback) override; |
| 107 const OfflinePageItem* MaybeGetBestPageForOnlineURL( | 111 const OfflinePageItem* MaybeGetBestPageForOnlineURL( |
| 108 const GURL& online_url) const override; | 112 const GURL& online_url) const override; |
| 109 void CheckMetadataConsistency() override; | 113 void CheckMetadataConsistency() override; |
| 110 void ExpirePages(const std::vector<int64_t>& offline_ids, | 114 void ExpirePages(const std::vector<int64_t>& offline_ids, |
| 111 const base::Time& expiration_time, | 115 const base::Time& expiration_time, |
| 112 const base::Callback<void(bool)>& callback) override; | 116 const base::Callback<void(bool)>& callback) override; |
| 117 void ExpireRemovedBookmarkPage(const bookmarks::BookmarkNode* node) override; |
| 113 ClientPolicyController* GetPolicyController() override; | 118 ClientPolicyController* GetPolicyController() override; |
| 114 | 119 |
| 115 // Methods for testing only: | 120 // Methods for testing only: |
| 116 OfflinePageMetadataStore* GetStoreForTesting(); | 121 OfflinePageMetadataStore* GetStoreForTesting(); |
| 117 | 122 |
| 118 OfflinePageStorageManager* GetStorageManager(); | 123 OfflinePageStorageManager* GetStorageManager(); |
| 119 | 124 |
| 120 bool is_loaded() const override; | 125 bool is_loaded() const override; |
| 121 | 126 |
| 122 OfflineEventLogger* GetLogger() override; | 127 OfflineEventLogger* GetLogger() override; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 void ClearStorageIfNeeded( | 262 void ClearStorageIfNeeded( |
| 258 const OfflinePageStorageManager::ClearStorageCallback& callback); | 263 const OfflinePageStorageManager::ClearStorageCallback& callback); |
| 259 | 264 |
| 260 // Callback completing storage clearing. | 265 // Callback completing storage clearing. |
| 261 void OnStorageCleared(size_t expired_page_count, | 266 void OnStorageCleared(size_t expired_page_count, |
| 262 OfflinePageStorageManager::ClearStorageResult result); | 267 OfflinePageStorageManager::ClearStorageResult result); |
| 263 | 268 |
| 264 // Post task to clear storage. | 269 // Post task to clear storage. |
| 265 void PostClearStorageIfNeededTask(); | 270 void PostClearStorageIfNeededTask(); |
| 266 | 271 |
| 272 // Expire associate pages when a bookmark gets deleted. |
| 273 void DoExpireRemovedBookmarkPages(const std::vector<int64_t>& offline_ids); |
| 274 void OnRemovedBookmarkPagesExpired(bool result); |
| 275 |
| 267 void RunWhenLoaded(const base::Closure& job); | 276 void RunWhenLoaded(const base::Closure& job); |
| 268 | 277 |
| 269 // Persistent store for offline page metadata. | 278 // Persistent store for offline page metadata. |
| 270 std::unique_ptr<OfflinePageMetadataStore> store_; | 279 std::unique_ptr<OfflinePageMetadataStore> store_; |
| 271 | 280 |
| 272 // Location where all of the archive files will be stored. | 281 // Location where all of the archive files will be stored. |
| 273 base::FilePath archives_dir_; | 282 base::FilePath archives_dir_; |
| 274 | 283 |
| 275 // The observers. | 284 // The observers. |
| 276 base::ObserverList<Observer> observers_; | 285 base::ObserverList<Observer> observers_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 300 OfflinePageModelEventLogger offline_event_logger_; | 309 OfflinePageModelEventLogger offline_event_logger_; |
| 301 | 310 |
| 302 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 311 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
| 303 | 312 |
| 304 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 313 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
| 305 }; | 314 }; |
| 306 | 315 |
| 307 } // namespace offline_pages | 316 } // namespace offline_pages |
| 308 | 317 |
| 309 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 318 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
| OLD | NEW |