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

Side by Side Diff: components/sync/api/model_type_change_processor.h

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Rebase. Created 4 years, 2 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ 5 #ifndef COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_
6 #define COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ 6 #define COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "components/sync/api/data_type_error_handler.h" 11 #include "components/sync/api/data_type_error_handler.h"
12 #include "components/sync/api/entity_data.h" 12 #include "components/sync/api/entity_data.h"
13 #include "components/sync/api/sync_error_factory.h" 13 #include "components/sync/api/sync_error_factory.h"
14 #include "components/sync/core/activation_context.h" 14 #include "components/sync/core/activation_context.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 class SyncError; 17 class SyncError;
18 } // namespace syncer 18 } // namespace syncer
19 19
20 namespace syncer_v2 { 20 namespace syncer {
21 21
22 class MetadataBatch; 22 class MetadataBatch;
23 class MetadataChangeList; 23 class MetadataChangeList;
24 24
25 // Interface used by the ModelTypeService to inform sync of local 25 // Interface used by the ModelTypeService to inform sync of local
26 // changes. 26 // changes.
27 class ModelTypeChangeProcessor : public syncer::SyncErrorFactory { 27 class ModelTypeChangeProcessor : public SyncErrorFactory {
28 public: 28 public:
29 typedef base::Callback<void(syncer::SyncError, 29 typedef base::Callback<void(SyncError, std::unique_ptr<ActivationContext>)>
30 std::unique_ptr<ActivationContext>)>
31 StartCallback; 30 StartCallback;
32 31
33 ModelTypeChangeProcessor(); 32 ModelTypeChangeProcessor();
34 ~ModelTypeChangeProcessor() override; 33 ~ModelTypeChangeProcessor() override;
35 34
36 // Inform the processor of a new or updated entity. The |entity_data| param 35 // Inform the processor of a new or updated entity. The |entity_data| param
37 // does not need to be fully set, but it should at least have specifics and 36 // does not need to be fully set, but it should at least have specifics and
38 // non-unique name. The processor will fill in the rest if the service does 37 // non-unique name. The processor will fill in the rest if the service does
39 // not have a reason to care. 38 // not have a reason to care.
40 virtual void Put(const std::string& storage_key, 39 virtual void Put(const std::string& storage_key,
41 std::unique_ptr<EntityData> entity_data, 40 std::unique_ptr<EntityData> entity_data,
42 MetadataChangeList* metadata_change_list) = 0; 41 MetadataChangeList* metadata_change_list) = 0;
43 42
44 // Inform the processor of a deleted entity. 43 // Inform the processor of a deleted entity.
45 virtual void Delete(const std::string& storage_key, 44 virtual void Delete(const std::string& storage_key,
46 MetadataChangeList* metadata_change_list) = 0; 45 MetadataChangeList* metadata_change_list) = 0;
47 46
48 // Accept the initial sync metadata loaded by the service. This should be 47 // Accept the initial sync metadata loaded by the service. This should be
49 // called as soon as the metadata is available to the service. 48 // called as soon as the metadata is available to the service.
50 virtual void OnMetadataLoaded(syncer::SyncError error, 49 virtual void OnMetadataLoaded(SyncError error,
51 std::unique_ptr<MetadataBatch> batch) = 0; 50 std::unique_ptr<MetadataBatch> batch) = 0;
52 51
53 // Indicates that sync wants to connect a sync worker to this processor. Once 52 // Indicates that sync wants to connect a sync worker to this processor. Once
54 // the processor has metadata from the service, it will pass the info needed 53 // the processor has metadata from the service, it will pass the info needed
55 // for the worker into |callback|. |error_handler| is how the processor will 54 // for the worker into |callback|. |error_handler| is how the processor will
56 // inform sync of any unrecoverable errors after calling |callback|, and it is 55 // inform sync of any unrecoverable errors after calling |callback|, and it is
57 // guaranteed to outlive the processor. StartCallback takes a SyncError and an 56 // guaranteed to outlive the processor. StartCallback takes a SyncError and an
58 // ActivationContext; the context should be nullptr iff the error is set. 57 // ActivationContext; the context should be nullptr iff the error is set.
59 virtual void OnSyncStarting( 58 virtual void OnSyncStarting(
60 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler, 59 std::unique_ptr<DataTypeErrorHandler> error_handler,
61 const StartCallback& callback) = 0; 60 const StartCallback& callback) = 0;
62 61
63 // Indicates that sync is being disabled permanently for this data type. All 62 // Indicates that sync is being disabled permanently for this data type. All
64 // metadata should be erased from storage. 63 // metadata should be erased from storage.
65 virtual void DisableSync() = 0; 64 virtual void DisableSync() = 0;
66 }; 65 };
67 66
68 } // namespace syncer_v2 67 } // namespace syncer
69 68
70 #endif // COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ 69 #endif // COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « components/sync/api/mock_model_type_store.cc ('k') | components/sync/api/model_type_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698