| 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_METADATA_STORE_SQL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_SQL_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_SQL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_SQL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // which is implemented using a SQLite database. | 28 // which is implemented using a SQLite database. |
| 29 class OfflinePageMetadataStoreSQL : public OfflinePageMetadataStore { | 29 class OfflinePageMetadataStoreSQL : public OfflinePageMetadataStore { |
| 30 public: | 30 public: |
| 31 OfflinePageMetadataStoreSQL( | 31 OfflinePageMetadataStoreSQL( |
| 32 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 32 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 33 const base::FilePath& database_dir); | 33 const base::FilePath& database_dir); |
| 34 ~OfflinePageMetadataStoreSQL() override; | 34 ~OfflinePageMetadataStoreSQL() override; |
| 35 | 35 |
| 36 // Implementation methods. | 36 // Implementation methods. |
| 37 void GetOfflinePages(const LoadCallback& callback) override; | 37 void GetOfflinePages(const LoadCallback& callback) override; |
| 38 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, | 38 void AddOfflinePage(const OfflinePageItem& offline_page, |
| 39 const UpdateCallback& callback) override; | 39 const AddCallback& callback) override; |
| 40 void UpdateOfflinePages(const std::vector<OfflinePageItem>& pages, |
| 41 const UpdateCallback& callback) override; |
| 40 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, | 42 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, |
| 41 const UpdateCallback& callback) override; | 43 const UpdateCallback& callback) override; |
| 42 void Reset(const ResetCallback& callback) override; | 44 void Reset(const ResetCallback& callback) override; |
| 43 StoreState state() const override; | 45 StoreState state() const override; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 // Used to initialize DB connection. | 48 // Used to initialize DB connection. |
| 47 void OpenConnection(); | 49 void OpenConnection(); |
| 48 void OnOpenConnectionDone(StoreState state); | 50 void OnOpenConnectionDone(StoreState state); |
| 49 | 51 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 68 StoreState state_; | 70 StoreState state_; |
| 69 | 71 |
| 70 base::WeakPtrFactory<OfflinePageMetadataStoreSQL> weak_ptr_factory_; | 72 base::WeakPtrFactory<OfflinePageMetadataStoreSQL> weak_ptr_factory_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(OfflinePageMetadataStoreSQL); | 74 DISALLOW_COPY_AND_ASSIGN(OfflinePageMetadataStoreSQL); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace offline_pages | 77 } // namespace offline_pages |
| 76 | 78 |
| 77 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_SQL_H_ | 79 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_SQL_H_ |
| OLD | NEW |