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 // Called when the set of encrypted types or the encrypt everything |
94 const syncable::ModelTypeSet& encrypted_types) = 0; | 94 // flag has been changed. Note that encryption isn't complete until |
| 95 // the OnEncryptionComplete() notification has been sent (see |
| 96 // below). |
| 97 // |
| 98 // |encrypted_types| will always be a superset of |
| 99 // Cryptographer::SensitiveTypes(). If |encrypt_everything| is |
| 100 // true, |encrypted_types| will be the set of all known types. |
| 101 // |
| 102 // Until this function is called, observers can assume that the set |
| 103 // of encrypted types is Cryptographer::SensitiveTypes() and that |
| 104 // the encrypt everything flag is false. |
| 105 virtual void OnEncryptedTypesChanged( |
| 106 const syncable::ModelTypeSet& encrypted_types, |
| 107 bool encrypt_everything) = 0; |
| 108 |
| 109 // Called after we finish encrypting the current set of encrypted |
| 110 // types. |
| 111 virtual void OnEncryptionComplete() = 0; |
95 | 112 |
96 // Called to perform migration of |types|. | 113 // Called to perform migration of |types|. |
97 virtual void OnMigrationNeededForTypes( | 114 virtual void OnMigrationNeededForTypes( |
98 const syncable::ModelTypeSet& types) = 0; | 115 const syncable::ModelTypeSet& types) = 0; |
99 | 116 |
100 // Inform the Frontend that new datatypes are available for registration. | 117 // Inform the Frontend that new datatypes are available for registration. |
101 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; | 118 virtual void OnDataTypesChanged(const syncable::ModelTypeSet& to_add) = 0; |
102 | 119 |
103 // Called when the sync cycle returns there is an user actionable error. | 120 // Called when the sync cycle returns there is an user actionable error. |
104 virtual void OnActionableError( | 121 virtual void OnActionableError( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 base::Callback<void(bool)> ready_task, | 199 base::Callback<void(bool)> ready_task, |
183 bool enable_nigori); | 200 bool enable_nigori); |
184 | 201 |
185 // Makes an asynchronous call to syncer to switch to config mode. When done | 202 // Makes an asynchronous call to syncer to switch to config mode. When done |
186 // syncer will call us back on FinishConfigureDataTypes. | 203 // syncer will call us back on FinishConfigureDataTypes. |
187 virtual void StartConfiguration(const base::Closure& callback); | 204 virtual void StartConfiguration(const base::Closure& callback); |
188 | 205 |
189 // Turns on encryption of all present and future sync data. | 206 // Turns on encryption of all present and future sync data. |
190 virtual void EnableEncryptEverything(); | 207 virtual void EnableEncryptEverything(); |
191 | 208 |
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 | 209 // Activates change processing for the given data type. This must |
200 // be called synchronously with the data type's model association so | 210 // be called synchronously with the data type's model association so |
201 // no changes are dropped between model association and change | 211 // no changes are dropped between model association and change |
202 // processor activation. | 212 // processor activation. |
203 void ActivateDataType( | 213 void ActivateDataType( |
204 syncable::ModelType type, ModelSafeGroup group, | 214 syncable::ModelType type, ModelSafeGroup group, |
205 ChangeProcessor* change_processor); | 215 ChangeProcessor* change_processor); |
206 | 216 |
207 // Deactivates change processing for the given data type. | 217 // Deactivates change processing for the given data type. |
208 void DeactivateDataType(syncable::ModelType type); | 218 void DeactivateDataType(syncable::ModelType type); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 virtual void OnAuthError( | 292 virtual void OnAuthError( |
283 const GoogleServiceAuthError& auth_error) OVERRIDE; | 293 const GoogleServiceAuthError& auth_error) OVERRIDE; |
284 virtual void OnPassphraseRequired( | 294 virtual void OnPassphraseRequired( |
285 sync_api::PassphraseRequiredReason reason) OVERRIDE; | 295 sync_api::PassphraseRequiredReason reason) OVERRIDE; |
286 virtual void OnPassphraseAccepted( | 296 virtual void OnPassphraseAccepted( |
287 const std::string& bootstrap_token) OVERRIDE; | 297 const std::string& bootstrap_token) OVERRIDE; |
288 virtual void OnStopSyncingPermanently() OVERRIDE; | 298 virtual void OnStopSyncingPermanently() OVERRIDE; |
289 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; | 299 virtual void OnUpdatedToken(const std::string& token) OVERRIDE; |
290 virtual void OnClearServerDataFailed() OVERRIDE; | 300 virtual void OnClearServerDataFailed() OVERRIDE; |
291 virtual void OnClearServerDataSucceeded() OVERRIDE; | 301 virtual void OnClearServerDataSucceeded() OVERRIDE; |
292 virtual void OnEncryptionComplete( | 302 virtual void OnEncryptedTypesChanged( |
293 const syncable::ModelTypeSet& encrypted_types); | 303 const syncable::ModelTypeSet& encrypted_types, |
| 304 bool encrypt_everything) OVERRIDE; |
| 305 virtual void OnEncryptionComplete() OVERRIDE; |
294 virtual void OnActionableError( | 306 virtual void OnActionableError( |
295 const browser_sync::SyncProtocolError& sync_error); | 307 const browser_sync::SyncProtocolError& sync_error) OVERRIDE; |
296 | 308 |
297 struct DoInitializeOptions { | 309 struct DoInitializeOptions { |
298 DoInitializeOptions( | 310 DoInitializeOptions( |
299 MessageLoop* sync_loop, | 311 MessageLoop* sync_loop, |
300 SyncBackendRegistrar* registrar, | 312 SyncBackendRegistrar* registrar, |
301 const WeakHandle<JsEventHandler>& event_handler, | 313 const WeakHandle<JsEventHandler>& event_handler, |
302 const GURL& service_url, | 314 const GURL& service_url, |
303 const scoped_refptr<net::URLRequestContextGetter>& | 315 const scoped_refptr<net::URLRequestContextGetter>& |
304 request_context_getter, | 316 request_context_getter, |
305 const sync_api::SyncCredentials& credentials, | 317 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, | 450 // Invoked when a passphrase is required to decrypt a set of Nigori keys, |
439 // or for encrypting. |reason| denotes why the passhrase was required. | 451 // or for encrypting. |reason| denotes why the passhrase was required. |
440 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); | 452 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason); |
441 | 453 |
442 // Invoked when the passphrase provided by the user has been accepted. | 454 // Invoked when the passphrase provided by the user has been accepted. |
443 void NotifyPassphraseAccepted(const std::string& bootstrap_token); | 455 void NotifyPassphraseAccepted(const std::string& bootstrap_token); |
444 | 456 |
445 // Invoked when an updated token is available from the sync server. | 457 // Invoked when an updated token is available from the sync server. |
446 void NotifyUpdatedToken(const std::string& token); | 458 void NotifyUpdatedToken(const std::string& token); |
447 | 459 |
448 // Invoked when sync finishes encrypting new datatypes or has become aware | 460 // Invoked when the set of encrypted types or the encrypt |
449 // of new datatypes requiring encryption. | 461 // everything flag changes. |
450 void NotifyEncryptionComplete(const syncable::ModelTypeSet& | 462 void NotifyEncryptedTypesChanged( |
451 encrypted_types); | 463 const syncable::ModelTypeSet& encrypted_types, |
| 464 bool encrypt_everything); |
| 465 |
| 466 // Invoked when sync finishes encrypting new datatypes. |
| 467 void NotifyEncryptionComplete(); |
452 | 468 |
453 // Called from Core::OnSyncCycleCompleted to handle updating frontend | 469 // Called from Core::OnSyncCycleCompleted to handle updating frontend |
454 // thread components. | 470 // thread components. |
455 void HandleSyncCycleCompletedOnFrontendLoop( | 471 void HandleSyncCycleCompletedOnFrontendLoop( |
456 sessions::SyncSessionSnapshot* snapshot); | 472 sessions::SyncSessionSnapshot* snapshot); |
457 | 473 |
458 void HandleStopSyncingPermanentlyOnFrontendLoop(); | 474 void HandleStopSyncingPermanentlyOnFrontendLoop(); |
459 | 475 |
460 // Called to handle success/failure of clearing server data | 476 // Called to handle success/failure of clearing server data |
461 void HandleClearServerDataSucceededOnFrontendLoop(); | 477 void HandleClearServerDataSucceededOnFrontendLoop(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 598 |
583 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. | 599 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. |
584 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; | 600 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; |
585 | 601 |
586 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 602 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
587 }; | 603 }; |
588 | 604 |
589 } // namespace browser_sync | 605 } // namespace browser_sync |
590 | 606 |
591 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 607 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |