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

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

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: 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 { 20 namespace syncer_v2 {
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 SyncErrorFactory { 27 class ModelTypeChangeProcessor : public syncer::SyncErrorFactory {
28 public: 28 public:
29 typedef base::Callback<void(SyncError, std::unique_ptr<ActivationContext>)> 29 typedef base::Callback<void(syncer::SyncError,
30 std::unique_ptr<ActivationContext>)>
30 StartCallback; 31 StartCallback;
31 32
32 ModelTypeChangeProcessor(); 33 ModelTypeChangeProcessor();
33 ~ModelTypeChangeProcessor() override; 34 ~ModelTypeChangeProcessor() override;
34 35
35 // Inform the processor of a new or updated entity. The |entity_data| param 36 // Inform the processor of a new or updated entity. The |entity_data| param
36 // does not need to be fully set, but it should at least have specifics and 37 // does not need to be fully set, but it should at least have specifics and
37 // non-unique name. The processor will fill in the rest if the service does 38 // non-unique name. The processor will fill in the rest if the service does
38 // not have a reason to care. 39 // not have a reason to care.
39 virtual void Put(const std::string& storage_key, 40 virtual void Put(const std::string& storage_key,
40 std::unique_ptr<EntityData> entity_data, 41 std::unique_ptr<EntityData> entity_data,
41 MetadataChangeList* metadata_change_list) = 0; 42 MetadataChangeList* metadata_change_list) = 0;
42 43
43 // Inform the processor of a deleted entity. 44 // Inform the processor of a deleted entity.
44 virtual void Delete(const std::string& storage_key, 45 virtual void Delete(const std::string& storage_key,
45 MetadataChangeList* metadata_change_list) = 0; 46 MetadataChangeList* metadata_change_list) = 0;
46 47
47 // Accept the initial sync metadata loaded by the service. This should be 48 // Accept the initial sync metadata loaded by the service. This should be
48 // called as soon as the metadata is available to the service. 49 // called as soon as the metadata is available to the service.
49 virtual void OnMetadataLoaded(SyncError error, 50 virtual void OnMetadataLoaded(syncer::SyncError error,
50 std::unique_ptr<MetadataBatch> batch) = 0; 51 std::unique_ptr<MetadataBatch> batch) = 0;
51 52
52 // Indicates that sync wants to connect a sync worker to this processor. Once 53 // Indicates that sync wants to connect a sync worker to this processor. Once
53 // the processor has metadata from the service, it will pass the info needed 54 // the processor has metadata from the service, it will pass the info needed
54 // for the worker into |callback|. |error_handler| is how the processor will 55 // for the worker into |callback|. |error_handler| is how the processor will
55 // inform sync of any unrecoverable errors after calling |callback|, and it is 56 // inform sync of any unrecoverable errors after calling |callback|, and it is
56 // guaranteed to outlive the processor. StartCallback takes a SyncError and an 57 // guaranteed to outlive the processor. StartCallback takes a SyncError and an
57 // ActivationContext; the context should be nullptr iff the error is set. 58 // ActivationContext; the context should be nullptr iff the error is set.
58 virtual void OnSyncStarting( 59 virtual void OnSyncStarting(
59 std::unique_ptr<DataTypeErrorHandler> error_handler, 60 std::unique_ptr<syncer::DataTypeErrorHandler> error_handler,
60 const StartCallback& callback) = 0; 61 const StartCallback& callback) = 0;
61 62
62 // Indicates that sync is being disabled permanently for this data type. All 63 // Indicates that sync is being disabled permanently for this data type. All
63 // metadata should be erased from storage. 64 // metadata should be erased from storage.
64 virtual void DisableSync() = 0; 65 virtual void DisableSync() = 0;
65 }; 66 };
66 67
67 } // namespace syncer 68 } // namespace syncer_v2
68 69
69 #endif // COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_ 70 #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