OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_ENGINE_SYNC_ENGINE_HOST_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ | 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/sync/base/model_type.h" | 10 #include "components/sync/base/model_type.h" |
11 #include "components/sync/base/weak_handle.h" | 11 #include "components/sync/base/weak_handle.h" |
12 #include "components/sync/engine/sync_encryption_handler.h" | 12 #include "components/sync/engine/sync_encryption_handler.h" |
13 #include "components/sync/engine/sync_manager.h" | 13 #include "components/sync/engine/sync_manager.h" |
14 #include "components/sync/protocol/sync_protocol_error.h" | 14 #include "components/sync/protocol/sync_protocol_error.h" |
15 | 15 |
16 namespace sync_pb { | |
17 class EncryptedData; | |
18 } // namespace sync_pb | |
19 | |
20 namespace syncer { | 16 namespace syncer { |
21 | 17 |
22 class DataTypeDebugInfoListener; | 18 class DataTypeDebugInfoListener; |
23 class JsBackend; | 19 class JsBackend; |
24 class ProtocolEvent; | 20 class ProtocolEvent; |
25 struct CommitCounters; | 21 struct CommitCounters; |
26 struct StatusCounters; | 22 struct StatusCounters; |
27 struct UpdateCounters; | 23 struct UpdateCounters; |
28 | 24 |
29 // SyncEngineHost is the interface used by SyncEngine to communicate with the | 25 // SyncEngineHost is the interface used by SyncEngine to communicate with the |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // | 73 // |
78 // Disabled by default. Enable by calling | 74 // Disabled by default. Enable by calling |
79 // EnableDirectoryTypeDebugInfoForwarding() on the engine. | 75 // EnableDirectoryTypeDebugInfoForwarding() on the engine. |
80 virtual void OnDatatypeStatusCounterUpdated( | 76 virtual void OnDatatypeStatusCounterUpdated( |
81 ModelType type, | 77 ModelType type, |
82 const StatusCounters& counters) = 0; | 78 const StatusCounters& counters) = 0; |
83 | 79 |
84 // The status of the connection to the sync server has changed. | 80 // The status of the connection to the sync server has changed. |
85 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; | 81 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; |
86 | 82 |
87 // The syncer requires a passphrase to decrypt sensitive updates. This is | |
88 // called when the first sensitive data type is setup by the user and anytime | |
89 // the passphrase is changed by another synced client. |reason| denotes why | |
90 // the passphrase was required. |pending_keys| is a copy of the | |
91 // cryptographer's pending keys to be passed on to the host in order to | |
92 // be cached. | |
93 virtual void OnPassphraseRequired( | |
94 PassphraseRequiredReason reason, | |
95 const sync_pb::EncryptedData& pending_keys) = 0; | |
96 | |
97 // Called when the passphrase provided by the user is | |
98 // accepted. After this is called, updates to sensitive nodes are | |
99 // encrypted using the accepted passphrase. | |
100 virtual void OnPassphraseAccepted() = 0; | |
101 | |
102 // Called when the set of encrypted types or the encrypt everything | |
103 // flag has been changed. Note that encryption isn't complete until | |
104 // the OnEncryptionComplete() notification has been sent (see | |
105 // below). | |
106 // | |
107 // |encrypted_types| will always be a superset of | |
108 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is | |
109 // true, |encrypted_types| will be the set of all known types. | |
110 // | |
111 // Until this function is called, observers can assume that the set | |
112 // of encrypted types is Cryptographer::SensitiveTypes() and that | |
113 // the encrypt everything flag is false. | |
114 virtual void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | |
115 bool encrypt_everything) = 0; | |
116 | |
117 // Called after we finish encrypting the current set of encrypted | |
118 // types. | |
119 virtual void OnEncryptionComplete() = 0; | |
120 | |
121 // Called to perform migration of |types|. | 83 // Called to perform migration of |types|. |
122 virtual void OnMigrationNeededForTypes(ModelTypeSet types) = 0; | 84 virtual void OnMigrationNeededForTypes(ModelTypeSet types) = 0; |
123 | 85 |
124 // Called when new datatypes are available for registration. | 86 // Called when new datatypes are available for registration. |
125 virtual void OnExperimentsChanged(const Experiments& experiments) = 0; | 87 virtual void OnExperimentsChanged(const Experiments& experiments) = 0; |
126 | 88 |
127 // Called when the sync cycle returns there is an user actionable error. | 89 // Called when the sync cycle returns there is an user actionable error. |
128 virtual void OnActionableError(const SyncProtocolError& error) = 0; | 90 virtual void OnActionableError(const SyncProtocolError& error) = 0; |
129 | |
130 // Called when the user of this device enables passphrase encryption. | |
131 // | |
132 // |nigori_state| contains the new (post custom passphrase) encryption keys | |
133 // and can be used to restore SyncEncryptionHandler's state across sync | |
134 // engine instances. See also SyncEncryptionHandlerImpl::RestoreNigori. | |
135 virtual void OnLocalSetPassphraseEncryption( | |
136 const SyncEncryptionHandler::NigoriState& nigori_state) = 0; | |
137 }; | 91 }; |
138 | 92 |
139 } // namespace syncer | 93 } // namespace syncer |
140 | 94 |
141 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ | 95 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
OLD | NEW |