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

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

Issue 2401223002: [Sync] Renaming sync/api* to sync/model*. (Closed)
Patch Set: Missed a comment in a DEPS file, and rebasing. 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
(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 COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_
6 #define COMPONENTS_SYNC_API_MODEL_TYPE_CHANGE_PROCESSOR_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "components/sync/api/data_type_error_handler.h"
12 #include "components/sync/api/entity_data.h"
13 #include "components/sync/api/sync_error_factory.h"
14 #include "components/sync/core/activation_context.h"
15
16 namespace syncer {
17 class SyncError;
18 } // namespace syncer
19
20 namespace syncer {
21
22 class MetadataBatch;
23 class MetadataChangeList;
24
25 // Interface used by the ModelTypeService to inform sync of local
26 // changes.
27 class ModelTypeChangeProcessor : public SyncErrorFactory {
28 public:
29 typedef base::Callback<void(SyncError, std::unique_ptr<ActivationContext>)>
30 StartCallback;
31
32 ModelTypeChangeProcessor();
33 ~ModelTypeChangeProcessor() override;
34
35 // 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 // non-unique name. The processor will fill in the rest if the service does
38 // not have a reason to care.
39 virtual void Put(const std::string& storage_key,
40 std::unique_ptr<EntityData> entity_data,
41 MetadataChangeList* metadata_change_list) = 0;
42
43 // Inform the processor of a deleted entity.
44 virtual void Delete(const std::string& storage_key,
45 MetadataChangeList* metadata_change_list) = 0;
46
47 // 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 virtual void OnMetadataLoaded(SyncError error,
50 std::unique_ptr<MetadataBatch> batch) = 0;
51
52 // 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 // 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 // guaranteed to outlive the processor. StartCallback takes a SyncError and an
57 // ActivationContext; the context should be nullptr iff the error is set.
58 virtual void OnSyncStarting(
59 std::unique_ptr<DataTypeErrorHandler> error_handler,
60 const StartCallback& callback) = 0;
61
62 // Indicates that sync is being disabled permanently for this data type. All
63 // metadata should be erased from storage.
64 virtual void DisableSync() = 0;
65 };
66
67 } // namespace syncer
68
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