OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 // the passphrase is changed by another synced client. |reason| denotes why | 83 // the passphrase is changed by another synced client. |reason| denotes why |
84 // the passphrase was required. | 84 // the passphrase was required. |
85 virtual void OnPassphraseRequired( | 85 virtual void OnPassphraseRequired( |
86 sync_api::PassphraseRequiredReason reason) = 0; | 86 sync_api::PassphraseRequiredReason reason) = 0; |
87 | 87 |
88 // Called when the passphrase provided by the user is | 88 // Called when the passphrase provided by the user is |
89 // accepted. After this is called, updates to sensitive nodes are | 89 // accepted. After this is called, updates to sensitive nodes are |
90 // encrypted using the accepted passphrase. | 90 // encrypted using the accepted passphrase. |
91 virtual void OnPassphraseAccepted() = 0; | 91 virtual void OnPassphraseAccepted() = 0; |
92 | 92 |
93 virtual void OnEncryptionComplete( | 93 // Guaranteed to be called once during initialization and before |
94 const syncable::ModelTypeSet& encrypted_types) = 0; | 94 // encryption is complete, but may be called at other times, too. |
95 virtual void OnEncryptedTypesChanged( | |
96 const syncable::ModelTypeSet& encrypted_types, | |
97 bool encrypt_everything) = 0; | |
98 | |
99 // Called when encryption is complete. Always preceded by a call to | |
100 // OnEncryptedTypesChanged. | |
Nicolas Zea
2011/10/21 14:29:07
I'm not sure I like enforcing this. See comments i
akalin
2011/10/22 03:28:38
Yeah, me neither. Removed that condition.
| |
101 virtual void OnEncryptionComplete() = 0; | |
95 | 102 |
96 // Called to perform migration of |types|. | 103 // Called to perform migration of |types|. |
97 virtual void OnMigrationNeededForTypes( | 104 virtual void OnMigrationNeededForTypes( |
98 const syncable::ModelTypeSet& types) = 0; | 105 const syncable::ModelTypeSet& types) = 0; |
99 | 106 |
100 // Inform the Frontend that new datatypes are available for registration. | 107 // Inform the Frontend that new datatypes are available for registration. |
101 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; | 108 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; |
102 | 109 |
103 // Called when the sync cycle returns there is an user actionable error. | 110 // Called when the sync cycle returns there is an user actionable error. |
104 virtual void OnActionableError( | 111 virtual void OnActionableError( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 base::Callback<void(bool)> ready_task, | 189 base::Callback<void(bool)> ready_task, |
183 bool enable_nigori); | 190 bool enable_nigori); |
184 | 191 |
185 // Makes an asynchronous call to syncer to switch to config mode. When done | 192 // Makes an asynchronous call to syncer to switch to config mode. When done |
186 // syncer will call us back on FinishConfigureDataTypes. | 193 // syncer will call us back on FinishConfigureDataTypes. |
187 virtual void StartConfiguration(const base::Closure& callback); | 194 virtual void StartConfiguration(const base::Closure& callback); |
188 | 195 |
189 // Turns on encryption of all present and future sync data. | 196 // Turns on encryption of all present and future sync data. |
190 virtual void EnableEncryptEverything(); | 197 virtual void EnableEncryptEverything(); |
191 | 198 |
192 // Returns true if we have enabled encrypt everything, false if we only | |
193 // encrypt the sensitive types. | |
194 virtual bool EncryptEverythingEnabled() const; | |
195 | |
196 // Returns the set of encrypted data types. | |
197 virtual syncable::ModelTypeSet GetEncryptedDataTypes() const; | |
198 | |
199 // Activates change processing for the given data type. This must | 199 // Activates change processing for the given data type. This must |
200 // be called synchronously with the data type's model association so | 200 // be called synchronously with the data type's model association so |
201 // no changes are dropped between model association and change | 201 // no changes are dropped between model association and change |
202 // processor activation. | 202 // processor activation. |
203 void ActivateDataType( | 203 void ActivateDataType( |
204 syncable::ModelType type, ModelSafeGroup group, | 204 syncable::ModelType type, ModelSafeGroup group, |
205 ChangeProcessor* change_processor); | 205 ChangeProcessor* change_processor); |
206 | 206 |
207 // Deactivates change processing for the given data type. | 207 // Deactivates change processing for the given data type. |
208 void DeactivateDataType(syncable::ModelType type); | 208 void DeactivateDataType(syncable::ModelType type); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 virtual void OnAuthError( | 282 virtual void OnAuthError( |
283 const GoogleServiceAuthError& auth_error) OVERRIDE; | 283 const GoogleServiceAuthError& auth_error) OVERRIDE; |
284 virtual void OnPassphraseRequired( | 284 virtual void OnPassphraseRequired( |
285 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 285 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
286 virtual void OnPassphraseAccepted( | 286 virtual void OnPassphraseAccepted( |
287 const std::string& bootstrap_token) OVERRIDE; | 287 const std::string& bootstrap_token) OVERRIDE; |
288 virtual void OnStopSyncingPermanently() OVERRIDE; | 288 virtual void OnStopSyncingPermanently() OVERRIDE; |
289 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 289 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
290 virtual void OnClearServerDataFailed() OVERRIDE; | 290 virtual void OnClearServerDataFailed() OVERRIDE; |
291 virtual void OnClearServerDataSucceeded() OVERRIDE; | 291 virtual void OnClearServerDataSucceeded() OVERRIDE; |
292 virtual void OnEncryptionComplete( | 292 virtual void OnEncryptedTypesChanged( |
293 const syncable::ModelTypeSet& encrypted_types); | 293 const syncable::ModelTypeSet& encrypted_types, |
294 bool encrypt_everything) OVERRIDE; | |
295 virtual void OnEncryptionComplete() OVERRIDE; | |
294 virtual void OnActionableError( | 296 virtual void OnActionableError( |
295 const browser_sync::SyncProtocolError& sync_error); | 297 const browser_sync::SyncProtocolError& sync_error) OVERRIDE; |
296 | 298 |
297 struct DoInitializeOptions { | 299 struct DoInitializeOptions { |
298 DoInitializeOptions( | 300 DoInitializeOptions( |
299 MessageLoop* sync_loop, | 301 MessageLoop* sync_loop, |
300 SyncBackendRegistrar* registrar, | 302 SyncBackendRegistrar* registrar, |
301 const WeakHandle<JsEventHandler>& event_handler, | 303 const WeakHandle<JsEventHandler>& event_handler, |
302 const GURL& service_url, | 304 const GURL& service_url, |
303 const scoped_refptr<net::URLRequestContextGetter>& | 305 const scoped_refptr<net::URLRequestContextGetter>& |
304 request_context_getter, | 306 request_context_getter, |
305 const sync_api::SyncCredentials& credentials, | 307 const sync_api::SyncCredentials& credentials, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 // Invoked when a passphrase is required to decrypt a set of Nigori keys, | 440 // Invoked when a passphrase is required to decrypt a set of Nigori keys, |
439 // or for encrypting. |reason| denotes why the passhrase was required. | 441 // or for encrypting. |reason| denotes why the passhrase was required. |
440 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); | 442 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); |
441 | 443 |
442 // Invoked when the passphrase provided by the user has been accepted. | 444 // Invoked when the passphrase provided by the user has been accepted. |
443 void NotifyPassphraseAccepted(const std::string& bootstrap_token); | 445 void NotifyPassphraseAccepted(const std::string& bootstrap_token); |
444 | 446 |
445 // Invoked when an updated token is available from the sync server. | 447 // Invoked when an updated token is available from the sync server. |
446 void NotifyUpdatedToken(const std::string& token); | 448 void NotifyUpdatedToken(const std::string& token); |
447 | 449 |
448 // Invoked when sync finishes encrypting new datatypes or has become aware | 450 // Invoked when the set of encrypted types changes. |
449 // of new datatypes requiring encryption. | 451 void NotifyEncryptedTypesChanged( |
450 void NotifyEncryptionComplete(const syncable::ModelTypeSet& | 452 const syncable::ModelTypeSet& encrypted_types, |
451 encrypted_types); | 453 bool encrypt_everything); |
454 | |
455 // Invoked when sync finishes encrypting new datatypes or has | |
456 // become aware of new datatypes requiring encryption. | |
Nicolas Zea
2011/10/21 14:29:07
remove the "has become aware of new datatypes..."
akalin
2011/10/22 03:28:38
Done.
| |
457 void NotifyEncryptionComplete(); | |
452 | 458 |
453 // Called from Core::OnSyncCycleCompleted to handle updating frontend | 459 // Called from Core::OnSyncCycleCompleted to handle updating frontend |
454 // thread components. | 460 // thread components. |
455 void HandleSyncCycleCompletedOnFrontendLoop( | 461 void HandleSyncCycleCompletedOnFrontendLoop( |
456 sessions::SyncSessionSnapshot* snapshot); | 462 sessions::SyncSessionSnapshot* snapshot); |
457 | 463 |
458 void HandleStopSyncingPermanentlyOnFrontendLoop(); | 464 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
459 | 465 |
460 // Called to handle success/failure of clearing server data | 466 // Called to handle success/failure of clearing server data |
461 void HandleClearServerDataSucceededOnFrontendLoop(); | 467 void HandleClearServerDataSucceededOnFrontendLoop(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 | 588 |
583 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 589 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
584 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 590 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
585 | 591 |
586 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 592 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
587 }; | 593 }; |
588 | 594 |
589 } // namespace browser_sync | 595 } // namespace browser_sync |
590 | 596 |
591 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 597 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |