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

Side by Side Diff: chrome/browser/sync/glue/sync_frontend.h

Issue 61183003: Refactor SyncBackendHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove double virtual Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_
7
8 #include "base/basictypes.h"
9 #include "sync/internal_api/public/base/model_type.h"
10 #include "sync/internal_api/public/sync_encryption_handler.h"
11 #include "sync/internal_api/public/sync_manager.h"
12 #include "sync/internal_api/public/util/weak_handle.h"
13 #include "sync/protocol/sync_protocol_error.h"
14
15 namespace syncer {
16 class DataTypeDebugInfoListener;
17 class JsBackend;
18 } // namespace syncer
19
20 namespace sync_pb {
21 class EncryptedData;
22 } // namespace sync_pb
23
24 namespace browser_sync {
25
26 // SyncFrontend is the interface used by SyncBackendHost to communicate with
27 // the entity that created it and, presumably, is interested in sync-related
28 // activity.
29 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread
30 // used to create that SyncBackendHost.
31 class SyncFrontend {
32 public:
33 SyncFrontend();
34
35 // The backend has completed initialization and it is now ready to
36 // accept and process changes. If success is false, initialization
37 // wasn't able to be completed and should be retried.
38 //
39 // |js_backend| is what about:sync interacts with; it's different
40 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It
41 // is initialized only if |success| is true.
42 virtual void OnBackendInitialized(
43 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
44 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
45 debug_info_listener,
46 bool success) = 0;
47
48 // The backend queried the server recently and received some updates.
49 virtual void OnSyncCycleCompleted() = 0;
50
51 // Configure ran into some kind of error. But it is scheduled to be
52 // retried.
53 virtual void OnSyncConfigureRetry() = 0;
54
55 // The status of the connection to the sync server has changed.
56 virtual void OnConnectionStatusChange(
57 syncer::ConnectionStatus status) = 0;
58
59 // We are no longer permitted to communicate with the server. Sync should
60 // be disabled and state cleaned up at once.
61 virtual void OnStopSyncingPermanently() = 0;
62
63 // The syncer requires a passphrase to decrypt sensitive updates. This is
64 // called when the first sensitive data type is setup by the user and anytime
65 // the passphrase is changed by another synced client. |reason| denotes why
66 // the passphrase was required. |pending_keys| is a copy of the
67 // cryptographer's pending keys to be passed on to the frontend in order to
68 // be cached.
69 virtual void OnPassphraseRequired(
70 syncer::PassphraseRequiredReason reason,
71 const sync_pb::EncryptedData& pending_keys) = 0;
72
73 // Called when the passphrase provided by the user is
74 // accepted. After this is called, updates to sensitive nodes are
75 // encrypted using the accepted passphrase.
76 virtual void OnPassphraseAccepted() = 0;
77
78 // Called when the set of encrypted types or the encrypt everything
79 // flag has been changed. Note that encryption isn't complete until
80 // the OnEncryptionComplete() notification has been sent (see
81 // below).
82 //
83 // |encrypted_types| will always be a superset of
84 // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is
85 // true, |encrypted_types| will be the set of all known types.
86 //
87 // Until this function is called, observers can assume that the set
88 // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that
89 // the encrypt everything flag is false.
90 virtual void OnEncryptedTypesChanged(
91 syncer::ModelTypeSet encrypted_types,
92 bool encrypt_everything) = 0;
93
94 // Called after we finish encrypting the current set of encrypted
95 // types.
96 virtual void OnEncryptionComplete() = 0;
97
98 // Called to perform migration of |types|.
99 virtual void OnMigrationNeededForTypes(syncer::ModelTypeSet types) = 0;
100
101 // Inform the Frontend that new datatypes are available for registration.
102 virtual void OnExperimentsChanged(
103 const syncer::Experiments& experiments) = 0;
104
105 // Called when the sync cycle returns there is an user actionable error.
106 virtual void OnActionableError(const syncer::SyncProtocolError& error) = 0;
107
108 protected:
109 // Don't delete through SyncFrontend interface.
110 virtual ~SyncFrontend();
Nicolas Zea 2013/11/06 18:03:21 I don't think this is really necessary (although I
rlarocque 2013/11/06 21:48:47 I don't see any harm in it.
Nicolas Zea 2013/11/06 22:18:25 Just to keep things consistent with other interfac
rlarocque 2013/11/06 22:48:47 OK. I'll remove it. I was hesitant before, becau
111
112 private:
113 DISALLOW_COPY_AND_ASSIGN(SyncFrontend);
Nicolas Zea 2013/11/06 18:03:21 I think typically we leave the DISALLOW_COPY_AND_A
rlarocque 2013/11/06 21:48:47 Done.
114 };
115
116 } // namespace browser_sync
117
118 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698