Chromium Code Reviews| Index: components/dom_distiller/core/dom_distiller_store.h |
| diff --git a/components/dom_distiller/core/dom_distiller_store.h b/components/dom_distiller/core/dom_distiller_store.h |
| index d2f073656dcb1ccbbb861fad536ac55d60106f07..57475c7fdb9d92bd6c861890114c674f898f3070 100644 |
| --- a/components/dom_distiller/core/dom_distiller_store.h |
| +++ b/components/dom_distiller/core/dom_distiller_store.h |
| @@ -11,6 +11,7 @@ |
| #include "base/containers/hash_tables.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| +#include "components/dom_distiller/core/article_attachments_data.h" |
| #include "components/dom_distiller/core/article_entry.h" |
| #include "components/dom_distiller/core/dom_distiller_model.h" |
| #include "components/dom_distiller/core/dom_distiller_observer.h" |
| @@ -27,6 +28,10 @@ namespace base { |
| class FilePath; |
| } |
| +namespace syncer { |
| +class AttachmentStore; |
| +} |
| + |
| namespace dom_distiller { |
| // Interface for accessing the stored/synced DomDistiller entries. |
| @@ -38,12 +43,22 @@ class DomDistillerStoreInterface { |
| virtual syncer::SyncableService* GetSyncableService() = 0; |
| virtual bool AddEntry(const ArticleEntry& entry) = 0; |
| - |
|
maniscalco
2014/11/12 18:59:44
Accidental line removal?
cjhopman
2014/11/14 02:45:15
Done. pulled the line removal into different chang
|
| // Returns false if |entry| is not present or |entry| was not updated. |
| virtual bool UpdateEntry(const ArticleEntry& entry) = 0; |
| - |
| virtual bool RemoveEntry(const ArticleEntry& entry) = 0; |
| + // Updates the attachments for an entry. |
| + typedef base::Callback<void(bool)> |
|
maniscalco
2014/11/12 18:59:44
What does the bool indicate?
cjhopman
2014/11/14 02:45:15
Done. added names here and documentation to the fu
|
| + UpdateAttachmentsCallback; |
| + typedef base::Callback<void(bool, scoped_ptr<ArticleAttachmentsData>)> |
| + GetAttachmentsCallback; |
| + virtual void UpdateAttachments( |
| + const std::string& entry_id, |
| + scoped_ptr<ArticleAttachmentsData> attachments, |
| + UpdateAttachmentsCallback callback) = 0; |
| + virtual void GetAttachments(const std::string& entry_id, |
| + GetAttachmentsCallback callback) = 0; |
| + |
| // Lookup an ArticleEntry by ID or URL. Returns whether a corresponding entry |
| // was found. On success, if |entry| is not null, it will contain the entry. |
| virtual bool GetEntryById(const std::string& entry_id, |
| @@ -96,12 +111,22 @@ class DomDistillerStore : public syncer::SyncableService, |
| // DomDistillerStoreInterface implementation. |
| syncer::SyncableService* GetSyncableService() override; |
| + |
| bool AddEntry(const ArticleEntry& entry) override; |
| bool UpdateEntry(const ArticleEntry& entry) override; |
| bool RemoveEntry(const ArticleEntry& entry) override; |
| + |
| + virtual void UpdateAttachments( |
| + const std::string& entry_id, |
| + scoped_ptr<ArticleAttachmentsData> attachments_data, |
| + UpdateAttachmentsCallback callback) override; |
| + virtual void GetAttachments(const std::string& entry_id, |
| + GetAttachmentsCallback callback) override; |
| + |
| bool GetEntryById(const std::string& entry_id, ArticleEntry* entry) override; |
| bool GetEntryByUrl(const GURL& url, ArticleEntry* entry) override; |
| std::vector<ArticleEntry> GetEntries() const override; |
| + |
| void AddObserver(DomDistillerObserver* observer) override; |
| void RemoveObserver(DomDistillerObserver* observer) override; |
| @@ -125,6 +150,18 @@ class DomDistillerStore : public syncer::SyncableService, |
| bool ChangeEntry(const ArticleEntry& entry, |
| syncer::SyncChange::SyncChangeType changeType); |
| + void OnAttachmentsWrite( |
| + const std::string& entry_id, |
| + scoped_ptr<sync_pb::ArticleAttachments> article_attachments, |
| + UpdateAttachmentsCallback callback, |
| + const syncer::AttachmentStore::Result& result); |
| + |
| + void OnAttachmentsRead(const sync_pb::ArticleAttachments& attachments_proto, |
| + GetAttachmentsCallback callback, |
| + const syncer::AttachmentStore::Result& result, |
| + scoped_ptr<syncer::AttachmentMap> attachments, |
| + scoped_ptr<syncer::AttachmentIdList> missing); |
| + |
| syncer::SyncMergeResult MergeDataWithModel( |
| const syncer::SyncDataList& data, syncer::SyncChangeList* changes_applied, |
| syncer::SyncChangeList* changes_missing); |
| @@ -152,6 +189,7 @@ class DomDistillerStore : public syncer::SyncableService, |
| scoped_ptr<syncer::SyncErrorFactory> error_factory_; |
| scoped_ptr<leveldb_proto::ProtoDatabase<ArticleEntry> > database_; |
| bool database_loaded_; |
| + scoped_refptr<syncer::AttachmentStore> attachment_store_; |
| ObserverList<DomDistillerObserver> observers_; |
| DomDistillerModel model_; |