| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // All blocking calls/disk access will happen on the provided |task_runner|. | 59 // All blocking calls/disk access will happen on the provided |task_runner|. |
| 60 OfflinePageModelImpl( | 60 OfflinePageModelImpl( |
| 61 std::unique_ptr<OfflinePageMetadataStore> store, | 61 std::unique_ptr<OfflinePageMetadataStore> store, |
| 62 const base::FilePath& archives_dir, | 62 const base::FilePath& archives_dir, |
| 63 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 63 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| 64 ~OfflinePageModelImpl() override; | 64 ~OfflinePageModelImpl() override; |
| 65 | 65 |
| 66 // Implemented methods: | 66 // Implemented methods: |
| 67 void AddObserver(Observer* observer) override; | 67 void AddObserver(Observer* observer) override; |
| 68 void RemoveObserver(Observer* observer) override; | 68 void RemoveObserver(Observer* observer) override; |
| 69 void SavePage(const GURL& url, | 69 void SavePage(const SavePageParams& save_page_params, |
| 70 const ClientId& client_id, | |
| 71 int64_t proposed_offline_id, | |
| 72 std::unique_ptr<OfflinePageArchiver> archiver, | 70 std::unique_ptr<OfflinePageArchiver> archiver, |
| 73 const SavePageCallback& callback) override; | 71 const SavePageCallback& callback) override; |
| 74 void MarkPageAccessed(int64_t offline_id) override; | 72 void MarkPageAccessed(int64_t offline_id) override; |
| 75 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 73 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
| 76 const DeletePageCallback& callback) override; | 74 const DeletePageCallback& callback) override; |
| 77 void DeletePagesByClientIds(const std::vector<ClientId>& client_ids, | 75 void DeletePagesByClientIds(const std::vector<ClientId>& client_ids, |
| 78 const DeletePageCallback& callback) override; | 76 const DeletePageCallback& callback) override; |
| 79 void GetPagesByClientIds( | 77 void GetPagesByClientIds( |
| 80 const std::vector<ClientId>& client_ids, | 78 const std::vector<ClientId>& client_ids, |
| 81 const MultipleOfflinePageItemCallback& callback) override; | 79 const MultipleOfflinePageItemCallback& callback) override; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void MarkPageAccessedWhenLoadDone(int64_t offline_id); | 144 void MarkPageAccessedWhenLoadDone(int64_t offline_id); |
| 147 | 145 |
| 148 void CheckMetadataConsistency(); | 146 void CheckMetadataConsistency(); |
| 149 | 147 |
| 150 // Callback for loading pages from the offline page metadata store. | 148 // Callback for loading pages from the offline page metadata store. |
| 151 void OnLoadDone(const base::TimeTicks& start_time, | 149 void OnLoadDone(const base::TimeTicks& start_time, |
| 152 OfflinePageMetadataStore::LoadStatus load_status, | 150 OfflinePageMetadataStore::LoadStatus load_status, |
| 153 const std::vector<OfflinePageItem>& offline_pages); | 151 const std::vector<OfflinePageItem>& offline_pages); |
| 154 | 152 |
| 155 // Steps for saving a page offline. | 153 // Steps for saving a page offline. |
| 156 void OnCreateArchiveDone(const GURL& requested_url, | 154 void OnCreateArchiveDone(const SavePageParams& save_page_params, |
| 157 int64_t offline_id, | 155 int64_t offline_id, |
| 158 const ClientId& client_id, | |
| 159 const base::Time& start_time, | 156 const base::Time& start_time, |
| 160 const SavePageCallback& callback, | 157 const SavePageCallback& callback, |
| 161 OfflinePageArchiver* archiver, | 158 OfflinePageArchiver* archiver, |
| 162 OfflinePageArchiver::ArchiverResult result, | 159 OfflinePageArchiver::ArchiverResult result, |
| 163 const GURL& url, | 160 const GURL& url, |
| 164 const base::FilePath& file_path, | 161 const base::FilePath& file_path, |
| 165 const base::string16& title, | 162 const base::string16& title, |
| 166 int64_t file_size); | 163 int64_t file_size); |
| 167 void OnAddOfflinePageDone(OfflinePageArchiver* archiver, | 164 void OnAddOfflinePageDone(OfflinePageArchiver* archiver, |
| 168 const SavePageCallback& callback, | 165 const SavePageCallback& callback, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::Clock* testing_clock_; | 284 base::Clock* testing_clock_; |
| 288 | 285 |
| 289 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; | 286 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; |
| 290 | 287 |
| 291 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); | 288 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); |
| 292 }; | 289 }; |
| 293 | 290 |
| 294 } // namespace offline_pages | 291 } // namespace offline_pages |
| 295 | 292 |
| 296 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ | 293 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ |
| OLD | NEW |