OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ |
6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const base::FilePath& database_dir); | 85 const base::FilePath& database_dir); |
86 | 86 |
87 // Creates storage using the given database for local storage. Initializes the | 87 // Creates storage using the given database for local storage. Initializes the |
88 // database with |database_dir|. Also initializes the internal model to | 88 // database with |database_dir|. Also initializes the internal model to |
89 // |initial_model|. | 89 // |initial_model|. |
90 DomDistillerStore( | 90 DomDistillerStore( |
91 scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database, | 91 scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database, |
92 const std::vector<ArticleEntry>& initial_data, | 92 const std::vector<ArticleEntry>& initial_data, |
93 const base::FilePath& database_dir); | 93 const base::FilePath& database_dir); |
94 | 94 |
95 virtual ~DomDistillerStore(); | 95 ~DomDistillerStore() override; |
96 | 96 |
97 // DomDistillerStoreInterface implementation. | 97 // DomDistillerStoreInterface implementation. |
98 virtual syncer::SyncableService* GetSyncableService() override; | 98 syncer::SyncableService* GetSyncableService() override; |
99 virtual bool AddEntry(const ArticleEntry& entry) override; | 99 bool AddEntry(const ArticleEntry& entry) override; |
100 virtual bool UpdateEntry(const ArticleEntry& entry) override; | 100 bool UpdateEntry(const ArticleEntry& entry) override; |
101 virtual bool RemoveEntry(const ArticleEntry& entry) override; | 101 bool RemoveEntry(const ArticleEntry& entry) override; |
102 virtual bool GetEntryById(const std::string& entry_id, | 102 bool GetEntryById(const std::string& entry_id, ArticleEntry* entry) override; |
103 ArticleEntry* entry) override; | 103 bool GetEntryByUrl(const GURL& url, ArticleEntry* entry) override; |
104 virtual bool GetEntryByUrl(const GURL& url, ArticleEntry* entry) override; | 104 std::vector<ArticleEntry> GetEntries() const override; |
105 virtual std::vector<ArticleEntry> GetEntries() const override; | 105 void AddObserver(DomDistillerObserver* observer) override; |
106 virtual void AddObserver(DomDistillerObserver* observer) override; | 106 void RemoveObserver(DomDistillerObserver* observer) override; |
107 virtual void RemoveObserver(DomDistillerObserver* observer) override; | |
108 | 107 |
109 // syncer::SyncableService implementation. | 108 // syncer::SyncableService implementation. |
110 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 109 syncer::SyncMergeResult MergeDataAndStartSyncing( |
111 syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, | 110 syncer::ModelType type, |
| 111 const syncer::SyncDataList& initial_sync_data, |
112 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 112 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
113 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 113 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
114 virtual void StopSyncing(syncer::ModelType type) override; | 114 void StopSyncing(syncer::ModelType type) override; |
115 virtual syncer::SyncDataList GetAllSyncData( | 115 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
116 syncer::ModelType type) const override; | 116 syncer::SyncError ProcessSyncChanges( |
117 virtual syncer::SyncError ProcessSyncChanges( | |
118 const tracked_objects::Location& from_here, | 117 const tracked_objects::Location& from_here, |
119 const syncer::SyncChangeList& change_list) override; | 118 const syncer::SyncChangeList& change_list) override; |
120 | 119 |
121 private: | 120 private: |
122 void OnDatabaseInit(bool success); | 121 void OnDatabaseInit(bool success); |
123 void OnDatabaseLoad(bool success, scoped_ptr<EntryVector> entries); | 122 void OnDatabaseLoad(bool success, scoped_ptr<EntryVector> entries); |
124 void OnDatabaseSave(bool success); | 123 void OnDatabaseSave(bool success); |
125 | 124 |
126 syncer::SyncMergeResult MergeDataWithModel( | 125 syncer::SyncMergeResult MergeDataWithModel( |
127 const syncer::SyncDataList& data, syncer::SyncChangeList* changes_applied, | 126 const syncer::SyncDataList& data, syncer::SyncChangeList* changes_applied, |
(...skipping 27 matching lines...) Expand all Loading... |
155 DomDistillerModel model_; | 154 DomDistillerModel model_; |
156 | 155 |
157 base::WeakPtrFactory<DomDistillerStore> weak_ptr_factory_; | 156 base::WeakPtrFactory<DomDistillerStore> weak_ptr_factory_; |
158 | 157 |
159 DISALLOW_COPY_AND_ASSIGN(DomDistillerStore); | 158 DISALLOW_COPY_AND_ASSIGN(DomDistillerStore); |
160 }; | 159 }; |
161 | 160 |
162 } // namespace dom_distiller | 161 } // namespace dom_distiller |
163 | 162 |
164 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ | 163 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_STORE_H_ |
OLD | NEW |