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

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

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

Powered by Google App Engine
This is Rietveld 408576698