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> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
20 #include "base/macros.h" | 20 #include "base/macros.h" |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "base/memory/scoped_vector.h" | 22 #include "base/memory/scoped_vector.h" |
23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
24 #include "base/observer_list.h" | 24 #include "base/observer_list.h" |
25 #include "base/optional.h" | 25 #include "base/optional.h" |
26 #include "components/keyed_service/core/keyed_service.h" | 26 #include "components/keyed_service/core/keyed_service.h" |
27 #include "components/offline_pages/offline_page_archiver.h" | 27 #include "components/offline_pages/offline_page_archiver.h" |
28 #include "components/offline_pages/offline_page_metadata_store.h" | 28 #include "components/offline_pages/offline_page_metadata_store.h" |
29 #include "components/offline_pages/offline_page_model.h" | 29 #include "components/offline_pages/offline_page_model.h" |
| 30 #include "components/offline_pages/offline_page_model_event_logger.h" |
30 #include "components/offline_pages/offline_page_storage_manager.h" | 31 #include "components/offline_pages/offline_page_storage_manager.h" |
31 #include "components/offline_pages/offline_page_types.h" | 32 #include "components/offline_pages/offline_page_types.h" |
32 | 33 |
33 class GURL; | 34 class GURL; |
34 namespace base { | 35 namespace base { |
35 class SequencedTaskRunner; | 36 class SequencedTaskRunner; |
36 class Time; | 37 class Time; |
37 class TimeDelta; | 38 class TimeDelta; |
38 class TimeTicks; | 39 class TimeTicks; |
39 } // namespace base | 40 } // namespace base |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const base::Callback<void(bool)>& callback) override; | 110 const base::Callback<void(bool)>& callback) override; |
110 ClientPolicyController* GetPolicyController() override; | 111 ClientPolicyController* GetPolicyController() override; |
111 | 112 |
112 // Methods for testing only: | 113 // Methods for testing only: |
113 OfflinePageMetadataStore* GetStoreForTesting(); | 114 OfflinePageMetadataStore* GetStoreForTesting(); |
114 | 115 |
115 OfflinePageStorageManager* GetStorageManager(); | 116 OfflinePageStorageManager* GetStorageManager(); |
116 | 117 |
117 bool is_loaded() const override; | 118 bool is_loaded() const override; |
118 | 119 |
| 120 OfflineEventLogger* GetLogger() override; |
| 121 |
119 protected: | 122 protected: |
120 // Adding a protected constructor for testing-only purposes in | 123 // Adding a protected constructor for testing-only purposes in |
121 // offline_page_storage_manager_unittest.cc | 124 // offline_page_storage_manager_unittest.cc |
122 OfflinePageModelImpl(); | 125 OfflinePageModelImpl(); |
123 | 126 |
124 private: | 127 private: |
125 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion); | 128 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion); |
126 | 129 |
127 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; | 130 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; |
128 | 131 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Controller of the client policies. | 279 // Controller of the client policies. |
277 std::unique_ptr<ClientPolicyController> policy_controller_; | 280 std::unique_ptr<ClientPolicyController> policy_controller_; |
278 | 281 |
279 // Manager for the storage consumed by archives and responsible for | 282 // Manager for the storage consumed by archives and responsible for |
280 // automatic page clearing. | 283 // automatic page clearing. |
281 std::unique_ptr<OfflinePageStorageManager> storage_manager_; | 284 std::unique_ptr<OfflinePageStorageManager> storage_manager_; |
282 | 285 |
283 // Manager for the offline archive files and directory. | 286 // Manager for the offline archive files and directory. |
284 std::unique_ptr<ArchiveManager> archive_manager_; | 287 std::unique_ptr<ArchiveManager> archive_manager_; |
285 | 288 |
| 289 // Logger to facilitate recording of events. |
| 290 OfflinePageModelEventLogger offline_event_logger_; |
| 291 |
286 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 292 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
287 | 293 |
288 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 294 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
289 }; | 295 }; |
290 | 296 |
291 } // namespace offline_pages | 297 } // namespace offline_pages |
292 | 298 |
293 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 299 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
OLD | NEW |