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 16 matching lines...) Expand all Loading... |
27 #include "components/keyed_service/core/keyed_service.h" | 27 #include "components/keyed_service/core/keyed_service.h" |
28 #include "components/offline_pages/offline_page_archiver.h" | 28 #include "components/offline_pages/offline_page_archiver.h" |
29 #include "components/offline_pages/offline_page_metadata_store.h" | 29 #include "components/offline_pages/offline_page_metadata_store.h" |
30 #include "components/offline_pages/offline_page_model.h" | 30 #include "components/offline_pages/offline_page_model.h" |
31 #include "components/offline_pages/offline_page_model_event_logger.h" | 31 #include "components/offline_pages/offline_page_model_event_logger.h" |
32 #include "components/offline_pages/offline_page_storage_manager.h" | 32 #include "components/offline_pages/offline_page_storage_manager.h" |
33 #include "components/offline_pages/offline_page_types.h" | 33 #include "components/offline_pages/offline_page_types.h" |
34 | 34 |
35 class GURL; | 35 class GURL; |
36 namespace base { | 36 namespace base { |
| 37 class Clock; |
37 class SequencedTaskRunner; | 38 class SequencedTaskRunner; |
38 class Time; | 39 class Time; |
39 class TimeDelta; | 40 class TimeDelta; |
40 class TimeTicks; | 41 class TimeTicks; |
41 } // namespace base | 42 } // namespace base |
42 | 43 |
43 namespace offline_pages { | 44 namespace offline_pages { |
44 | 45 |
45 static const int64_t kInvalidOfflineId = 0; | 46 static const int64_t kInvalidOfflineId = 0; |
46 | 47 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const OfflinePageItem* MaybeGetBestPageForOnlineURL( | 108 const OfflinePageItem* MaybeGetBestPageForOnlineURL( |
108 const GURL& online_url) const override; | 109 const GURL& online_url) const override; |
109 void CheckMetadataConsistency() override; | 110 void CheckMetadataConsistency() override; |
110 void ExpirePages(const std::vector<int64_t>& offline_ids, | 111 void ExpirePages(const std::vector<int64_t>& offline_ids, |
111 const base::Time& expiration_time, | 112 const base::Time& expiration_time, |
112 const base::Callback<void(bool)>& callback) override; | 113 const base::Callback<void(bool)>& callback) override; |
113 ClientPolicyController* GetPolicyController() override; | 114 ClientPolicyController* GetPolicyController() override; |
114 | 115 |
115 // Methods for testing only: | 116 // Methods for testing only: |
116 OfflinePageMetadataStore* GetStoreForTesting(); | 117 OfflinePageMetadataStore* GetStoreForTesting(); |
| 118 void SetClockForTesting(std::unique_ptr<base::Clock> clock); |
117 | 119 |
118 OfflinePageStorageManager* GetStorageManager(); | 120 OfflinePageStorageManager* GetStorageManager(); |
119 | 121 |
120 bool is_loaded() const override; | 122 bool is_loaded() const override; |
121 | 123 |
122 OfflineEventLogger* GetLogger() override; | 124 OfflineEventLogger* GetLogger() override; |
123 | 125 |
124 protected: | 126 protected: |
125 // Adding a protected constructor for testing-only purposes in | 127 // Adding a protected constructor for testing-only purposes in |
126 // offline_page_storage_manager_unittest.cc | 128 // offline_page_storage_manager_unittest.cc |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Manager for the storage consumed by archives and responsible for | 295 // Manager for the storage consumed by archives and responsible for |
294 // automatic page clearing. | 296 // automatic page clearing. |
295 std::unique_ptr<OfflinePageStorageManager> storage_manager_; | 297 std::unique_ptr<OfflinePageStorageManager> storage_manager_; |
296 | 298 |
297 // Manager for the offline archive files and directory. | 299 // Manager for the offline archive files and directory. |
298 std::unique_ptr<ArchiveManager> archive_manager_; | 300 std::unique_ptr<ArchiveManager> archive_manager_; |
299 | 301 |
300 // Logger to facilitate recording of events. | 302 // Logger to facilitate recording of events. |
301 OfflinePageModelEventLogger offline_event_logger_; | 303 OfflinePageModelEventLogger offline_event_logger_; |
302 | 304 |
| 305 // Clock for getting time. |
| 306 std::unique_ptr<base::Clock> clock_; |
| 307 |
303 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 308 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
304 | 309 |
305 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 310 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
306 }; | 311 }; |
307 | 312 |
308 } // namespace offline_pages | 313 } // namespace offline_pages |
309 | 314 |
310 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 315 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
OLD | NEW |