Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: components/offline_pages/offline_page_model_impl.h

Issue 2089413002: [Offline Pages] Create a event/activity logger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 static const int64_t kInvalidOfflineId = 0; 43 static const int64_t kInvalidOfflineId = 0;
44 44
45 struct ClientId; 45 struct ClientId;
46 struct OfflinePageItem; 46 struct OfflinePageItem;
47 47
48 class ArchiveManager; 48 class ArchiveManager;
49 class ClientPolicyController; 49 class ClientPolicyController;
50 class OfflinePageMetadataStore; 50 class OfflinePageMetadataStore;
51 class OfflinePageStorageManager; 51 class OfflinePageStorageManager;
52 class OfflinePageModelEventLogger;
52 53
53 // Implementation of service for saving pages offline, storing the offline 54 // Implementation of service for saving pages offline, storing the offline
54 // copy and metadata, and retrieving them upon request. 55 // copy and metadata, and retrieving them upon request.
55 class OfflinePageModelImpl : public OfflinePageModel, public KeyedService { 56 class OfflinePageModelImpl : public OfflinePageModel, public KeyedService {
56 public: 57 public:
57 // All blocking calls/disk access will happen on the provided |task_runner|. 58 // All blocking calls/disk access will happen on the provided |task_runner|.
58 OfflinePageModelImpl( 59 OfflinePageModelImpl(
59 std::unique_ptr<OfflinePageMetadataStore> store, 60 std::unique_ptr<OfflinePageMetadataStore> store,
60 const base::FilePath& archives_dir, 61 const base::FilePath& archives_dir,
61 const scoped_refptr<base::SequencedTaskRunner>& task_runner); 62 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void GetLogs(std::vector<std::string>& storage_vector) override;
121 void SetIsLogging(bool should_log) override;
122
119 protected: 123 protected:
120 // Adding a protected constructor for testing-only purposes in 124 // Adding a protected constructor for testing-only purposes in
121 // offline_page_storage_manager_unittest.cc 125 // offline_page_storage_manager_unittest.cc
122 OfflinePageModelImpl(); 126 OfflinePageModelImpl();
123 127
124 private: 128 private:
125 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion); 129 FRIEND_TEST_ALL_PREFIXES(OfflinePageModelImplTest, MarkPageForDeletion);
126 130
127 typedef ScopedVector<OfflinePageArchiver> PendingArchivers; 131 typedef ScopedVector<OfflinePageArchiver> PendingArchivers;
128 132
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Controller of the client policies. 270 // Controller of the client policies.
267 std::unique_ptr<ClientPolicyController> policy_controller_; 271 std::unique_ptr<ClientPolicyController> policy_controller_;
268 272
269 // Manager for the storage consumed by archives and responsible for 273 // Manager for the storage consumed by archives and responsible for
270 // automatic page clearing. 274 // automatic page clearing.
271 std::unique_ptr<OfflinePageStorageManager> storage_manager_; 275 std::unique_ptr<OfflinePageStorageManager> storage_manager_;
272 276
273 // Manager for the offline archive files and directory. 277 // Manager for the offline archive files and directory.
274 std::unique_ptr<ArchiveManager> archive_manager_; 278 std::unique_ptr<ArchiveManager> archive_manager_;
275 279
280 // Logger to facilitate recording of events.
281 OfflinePageModelEventLogger offline_event_logger_;
282
276 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; 283 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_;
277 284
278 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); 285 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl);
279 }; 286 };
280 287
281 } // namespace offline_pages 288 } // namespace offline_pages
282 289
283 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 290 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698