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

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_store.h

Issue 2525663002: Refactor Reading List Model to use URL as key. (Closed)
Patch Set: format Created 4 years 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 IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_ 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_
6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_ 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_
7 7
8 #include "base/threading/non_thread_safe.h" 8 #include "base/threading/non_thread_safe.h"
9 #include "components/sync/model/model_type_store.h" 9 #include "components/sync/model/model_type_store.h"
10 #include "components/sync/model/model_type_sync_bridge.h" 10 #include "components/sync/model/model_type_sync_bridge.h"
(...skipping 17 matching lines...) Expand all
28 ReadingListStore(StoreFactoryFunction create_store_callback, 28 ReadingListStore(StoreFactoryFunction create_store_callback,
29 const ChangeProcessorFactory& change_processor_factory); 29 const ChangeProcessorFactory& change_processor_factory);
30 ~ReadingListStore() override; 30 ~ReadingListStore() override;
31 31
32 std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() override; 32 std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() override;
33 33
34 // ReadingListModelStorage implementation 34 // ReadingListModelStorage implementation
35 void SetReadingListModel(ReadingListModel* model, 35 void SetReadingListModel(ReadingListModel* model,
36 ReadingListStoreDelegate* delegate) override; 36 ReadingListStoreDelegate* delegate) override;
37 37
38 void SaveEntry(const ReadingListEntry& entry, bool read) override; 38 void SaveEntry(const ReadingListEntry* entry) override;
jif-google 2016/11/22 18:21:45 why a pointer?
Olivier 2016/11/28 14:54:15 done.
39 void RemoveEntry(const ReadingListEntry& entry) override; 39 void RemoveEntry(const ReadingListEntry* entry) override;
jif-google 2016/11/22 18:21:45 same
Olivier 2016/11/28 14:54:15 Done.
40 40
41 // ReadingListModelStorage implementation. 41 // ReadingListModelStorage implementation.
42 syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() override; 42 syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() override;
43 43
44 // Creates an object used to communicate changes in the sync metadata to the 44 // Creates an object used to communicate changes in the sync metadata to the
45 // model type store. 45 // model type store.
46 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList() 46 std::unique_ptr<syncer::MetadataChangeList> CreateMetadataChangeList()
47 override; 47 override;
48 48
49 // Perform the initial merge between local and sync data. This should only be 49 // Perform the initial merge between local and sync data. This should only be
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void CommitTransaction(); 116 void CommitTransaction();
117 // Callbacks needed for the database handling. 117 // Callbacks needed for the database handling.
118 void OnDatabaseLoad( 118 void OnDatabaseLoad(
119 syncer::ModelTypeStore::Result result, 119 syncer::ModelTypeStore::Result result,
120 std::unique_ptr<syncer::ModelTypeStore::RecordList> entries); 120 std::unique_ptr<syncer::ModelTypeStore::RecordList> entries);
121 void OnDatabaseSave(syncer::ModelTypeStore::Result result); 121 void OnDatabaseSave(syncer::ModelTypeStore::Result result);
122 void OnReadAllMetadata(syncer::SyncError sync_error, 122 void OnReadAllMetadata(syncer::SyncError sync_error,
123 std::unique_ptr<syncer::MetadataBatch> metadata_batch); 123 std::unique_ptr<syncer::MetadataBatch> metadata_batch);
124 124
125 void AddEntryToBatch(syncer::MutableDataBatch* batch, 125 void AddEntryToBatch(syncer::MutableDataBatch* batch,
126 const ReadingListEntry& entry, 126 const ReadingListEntry* entry);
jif-google 2016/11/22 18:21:45 same
Olivier 2016/11/28 14:54:15 Done.
127 bool read);
128 127
129 std::unique_ptr<syncer::ModelTypeStore> store_; 128 std::unique_ptr<syncer::ModelTypeStore> store_;
130 ReadingListModel* model_; 129 ReadingListModel* model_;
131 ReadingListStoreDelegate* delegate_; 130 ReadingListStoreDelegate* delegate_;
132 StoreFactoryFunction create_store_callback_; 131 StoreFactoryFunction create_store_callback_;
133 132
134 int pending_transaction_count_; 133 int pending_transaction_count_;
135 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; 134 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_;
136 }; 135 };
137 136
138 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_ 137 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698