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

Side by Side Diff: components/sync_driver/sync_frontend.h

Issue 2203673002: [Sync] Move //components/sync_driver to //components/sync/driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sd-a
Patch Set: Full change rebased on static lib. 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
OLDNEW
(Empty)
1 // Copyright 2014 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_DRIVER_SYNC_FRONTEND_H_
6 #define COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_
7
8 #include <string>
9
10 #include "components/sync/base/model_type.h"
11 #include "components/sync/base/weak_handle.h"
12 #include "components/sync/core/sync_encryption_handler.h"
13 #include "components/sync/core/sync_manager.h"
14 #include "components/sync/protocol/sync_protocol_error.h"
15
16 namespace syncer {
17 class DataTypeDebugInfoListener;
18 class JsBackend;
19 class ProtocolEvent;
20 struct CommitCounters;
21 struct StatusCounters;
22 struct UpdateCounters;
23 } // namespace syncer
24
25 namespace sync_pb {
26 class EncryptedData;
27 } // namespace sync_pb
28
29 namespace sync_driver {
30
31 // SyncFrontend is the interface used by SyncBackendHost to communicate with
32 // the entity that created it and, presumably, is interested in sync-related
33 // activity.
34 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread
35 // used to create that SyncBackendHost.
36 class SyncFrontend {
37 public:
38 SyncFrontend();
39 virtual ~SyncFrontend();
40
41 // The backend has completed initialization and it is now ready to
42 // accept and process changes. If success is false, initialization
43 // wasn't able to be completed and should be retried.
44 //
45 // |js_backend| is what about:sync interacts with; it's different
46 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It
47 // is initialized only if |success| is true.
48 virtual void OnBackendInitialized(
49 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
50 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
51 debug_info_listener,
52 const std::string& cache_guid,
53 bool success) = 0;
54
55 // The backend queried the server recently and received some updates.
56 virtual void OnSyncCycleCompleted() = 0;
57
58 // Informs the frontned of some network event. These notifications are
59 // disabled by default and must be enabled through an explicit request to the
60 // SyncBackendHost.
61 //
62 // It's disabld by default to avoid copying data across threads when no one
63 // is listening for it.
64 virtual void OnProtocolEvent(const syncer::ProtocolEvent& event) = 0;
65
66 // Called when we receive an updated commit counter for a directory type.
67 //
68 // Disabled by default. Enable by calling
69 // EnableDirectoryTypeDebugInfoForwarding() on the backend.
70 virtual void OnDirectoryTypeCommitCounterUpdated(
71 syncer::ModelType type,
72 const syncer::CommitCounters& counters) = 0;
73
74 // Called when we receive an updated update counter for a directory type.
75 //
76 // Disabled by default. Enable by calling
77 // EnableDirectoryTypeDebugInfoForwarding() on the backend.
78 virtual void OnDirectoryTypeUpdateCounterUpdated(
79 syncer::ModelType type,
80 const syncer::UpdateCounters& counters) = 0;
81
82 // Called when we receive an updated status counter for a directory type.
83 //
84 // Disabled by default. Enable by calling
85 // EnableDirectoryTypeDebugInfoForwarding() on the backend.
86 virtual void OnDirectoryTypeStatusCounterUpdated(
87 syncer::ModelType type,
88 const syncer::StatusCounters& counters) = 0;
89
90 // The status of the connection to the sync server has changed.
91 virtual void OnConnectionStatusChange(
92 syncer::ConnectionStatus status) = 0;
93
94 // The syncer requires a passphrase to decrypt sensitive updates. This is
95 // called when the first sensitive data type is setup by the user and anytime
96 // the passphrase is changed by another synced client. |reason| denotes why
97 // the passphrase was required. |pending_keys| is a copy of the
98 // cryptographer's pending keys to be passed on to the frontend in order to
99 // be cached.
100 virtual void OnPassphraseRequired(
101 syncer::PassphraseRequiredReason reason,
102 const sync_pb::EncryptedData& pending_keys) = 0;
103
104 // Called when the passphrase provided by the user is
105 // accepted. After this is called, updates to sensitive nodes are
106 // encrypted using the accepted passphrase.
107 virtual void OnPassphraseAccepted() = 0;
108
109 // Called when the set of encrypted types or the encrypt everything
110 // flag has been changed. Note that encryption isn't complete until
111 // the OnEncryptionComplete() notification has been sent (see
112 // below).
113 //
114 // |encrypted_types| will always be a superset of
115 // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is
116 // true, |encrypted_types| will be the set of all known types.
117 //
118 // Until this function is called, observers can assume that the set
119 // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that
120 // the encrypt everything flag is false.
121 virtual void OnEncryptedTypesChanged(
122 syncer::ModelTypeSet encrypted_types,
123 bool encrypt_everything) = 0;
124
125 // Called after we finish encrypting the current set of encrypted
126 // types.
127 virtual void OnEncryptionComplete() = 0;
128
129 // Called to perform migration of |types|.
130 virtual void OnMigrationNeededForTypes(syncer::ModelTypeSet types) = 0;
131
132 // Inform the Frontend that new datatypes are available for registration.
133 virtual void OnExperimentsChanged(
134 const syncer::Experiments& experiments) = 0;
135
136 // Called when the sync cycle returns there is an user actionable error.
137 virtual void OnActionableError(const syncer::SyncProtocolError& error) = 0;
138
139 // Called when the user of this device enables passphrase encryption.
140 //
141 // |nigori_state| contains the new (post custom passphrase) encryption keys
142 // and can be used to restore SyncEncryptionHandler's state across sync
143 // backend instances. See also SyncEncryptionHandlerImpl::RestoreNigori.
144 virtual void OnLocalSetPassphraseEncryption(
145 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) = 0;
146 };
147
148 } // namespace sync_driver
149
150 #endif // COMPONENTS_SYNC_DRIVER_SYNC_FRONTEND_H_
OLDNEW
« no previous file with comments | « components/sync_driver/sync_error_controller.cc ('k') | components/sync_driver/sync_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698