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 #include "ios/chrome/browser/reading_list/reading_list_store.h" | 5 #include "components/reading_list/reading_list_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/reading_list/proto/reading_list.pb.h" |
| 11 #include "components/reading_list/reading_list_model_impl.h" |
10 #include "components/sync/model/entity_change.h" | 12 #include "components/sync/model/entity_change.h" |
11 #include "components/sync/model/metadata_batch.h" | 13 #include "components/sync/model/metadata_batch.h" |
12 #include "components/sync/model/metadata_change_list.h" | 14 #include "components/sync/model/metadata_change_list.h" |
13 #include "components/sync/model/model_type_change_processor.h" | 15 #include "components/sync/model/model_type_change_processor.h" |
14 #include "components/sync/model/mutable_data_batch.h" | 16 #include "components/sync/model/mutable_data_batch.h" |
15 #include "components/sync/model_impl/accumulating_metadata_change_list.h" | 17 #include "components/sync/model_impl/accumulating_metadata_change_list.h" |
16 #include "components/sync/protocol/model_type_state.pb.h" | 18 #include "components/sync/protocol/model_type_state.pb.h" |
17 #include "ios/chrome/browser/reading_list/proto/reading_list.pb.h" | |
18 #include "ios/chrome/browser/reading_list/reading_list_model_impl.h" | |
19 #include "ios/web/public/web_thread.h" | |
20 | 19 |
21 ReadingListStore::ReadingListStore( | 20 ReadingListStore::ReadingListStore( |
22 StoreFactoryFunction create_store_callback, | 21 StoreFactoryFunction create_store_callback, |
23 const ChangeProcessorFactory& change_processor_factory) | 22 const ChangeProcessorFactory& change_processor_factory) |
24 : ModelTypeSyncBridge(change_processor_factory, syncer::READING_LIST), | 23 : ModelTypeSyncBridge(change_processor_factory, syncer::READING_LIST), |
25 create_store_callback_(create_store_callback), | 24 create_store_callback_(create_store_callback), |
26 pending_transaction_count_(0) {} | 25 pending_transaction_count_(0) {} |
27 | 26 |
28 ReadingListStore::~ReadingListStore() { | 27 ReadingListStore::~ReadingListStore() { |
29 DCHECK(pending_transaction_count_ == 0); | 28 DCHECK(pending_transaction_count_ == 0); |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // called once when first encountering a remote entity. Local changes will | 451 // called once when first encountering a remote entity. Local changes will |
453 // provide their storage keys directly to Put instead of using this method. | 452 // provide their storage keys directly to Put instead of using this method. |
454 // Theoretically this function doesn't need to be stable across multiple calls | 453 // Theoretically this function doesn't need to be stable across multiple calls |
455 // on the same or different clients, but to keep things simple, it probably | 454 // on the same or different clients, but to keep things simple, it probably |
456 // should be. | 455 // should be. |
457 std::string ReadingListStore::GetStorageKey( | 456 std::string ReadingListStore::GetStorageKey( |
458 const syncer::EntityData& entity_data) { | 457 const syncer::EntityData& entity_data) { |
459 DCHECK(CalledOnValidThread()); | 458 DCHECK(CalledOnValidThread()); |
460 return entity_data.specifics.reading_list().entry_id(); | 459 return entity_data.specifics.reading_list().entry_id(); |
461 } | 460 } |
OLD | NEW |