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

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

Issue 6902101: Refactor sync passphrase setup flow and fix passphrase tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 virtual void OnAuthError() = 0; 72 virtual void OnAuthError() = 0;
73 73
74 // We are no longer permitted to communicate with the server. Sync should 74 // We are no longer permitted to communicate with the server. Sync should
75 // be disabled and state cleaned up at once. 75 // be disabled and state cleaned up at once.
76 virtual void OnStopSyncingPermanently() = 0; 76 virtual void OnStopSyncingPermanently() = 0;
77 77
78 // Called to handle success/failure of clearing server data 78 // Called to handle success/failure of clearing server data
79 virtual void OnClearServerDataSucceeded() = 0; 79 virtual void OnClearServerDataSucceeded() = 0;
80 virtual void OnClearServerDataFailed() = 0; 80 virtual void OnClearServerDataFailed() = 0;
81 81
82 // The syncer requires a passphrase to decrypt sensitive 82 // The syncer requires a passphrase to decrypt sensitive updates. This is
83 // updates. This is called when the first sensitive data type is 83 // called when the first sensitive data type is setup by the user and anytime
84 // setup by the user as well as anytime any the passphrase is 84 // the passphrase is changed by another synced client. |reason| denotes why
85 // changed in another synced client. if 85 // the passphrase was required.
86 // |passphrase_required_for_decryption| is false, the passphrase is 86 virtual void OnPassphraseRequired(
87 // required only for encryption. 87 sync_api::PassphraseRequiredReason reason) = 0;
88 virtual void OnPassphraseRequired(bool for_decryption) = 0;
89 88
90 // Called when the passphrase provided by the user is 89 // Called when the passphrase provided by the user is
91 // accepted. After this is called, updates to sensitive nodes are 90 // accepted. After this is called, updates to sensitive nodes are
92 // encrypted using the accepted passphrase. 91 // encrypted using the accepted passphrase.
93 virtual void OnPassphraseAccepted() = 0; 92 virtual void OnPassphraseAccepted() = 0;
94 93
95 virtual void OnEncryptionComplete( 94 virtual void OnEncryptionComplete(
96 const syncable::ModelTypeSet& encrypted_types) = 0; 95 const syncable::ModelTypeSet& encrypted_types) = 0;
97 96
98 // Called to perform migration of |types|. 97 // Called to perform migration of |types|.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 virtual void OnChangesApplied( 269 virtual void OnChangesApplied(
271 syncable::ModelType model_type, 270 syncable::ModelType model_type,
272 const sync_api::BaseTransaction* trans, 271 const sync_api::BaseTransaction* trans,
273 const sync_api::SyncManager::ChangeRecord* changes, 272 const sync_api::SyncManager::ChangeRecord* changes,
274 int change_count); 273 int change_count);
275 virtual void OnChangesComplete(syncable::ModelType model_type); 274 virtual void OnChangesComplete(syncable::ModelType model_type);
276 virtual void OnSyncCycleCompleted( 275 virtual void OnSyncCycleCompleted(
277 const sessions::SyncSessionSnapshot* snapshot); 276 const sessions::SyncSessionSnapshot* snapshot);
278 virtual void OnInitializationComplete(); 277 virtual void OnInitializationComplete();
279 virtual void OnAuthError(const GoogleServiceAuthError& auth_error); 278 virtual void OnAuthError(const GoogleServiceAuthError& auth_error);
280 virtual void OnPassphraseRequired(bool for_decryption); 279 virtual void OnPassphraseRequired(
281 virtual void OnPassphraseFailed(); 280 sync_api::PassphraseRequiredReason reason);
282 virtual void OnPassphraseAccepted(const std::string& bootstrap_token); 281 virtual void OnPassphraseAccepted(const std::string& bootstrap_token);
283 virtual void OnStopSyncingPermanently(); 282 virtual void OnStopSyncingPermanently();
284 virtual void OnUpdatedToken(const std::string& token); 283 virtual void OnUpdatedToken(const std::string& token);
285 virtual void OnClearServerDataFailed(); 284 virtual void OnClearServerDataFailed();
286 virtual void OnClearServerDataSucceeded(); 285 virtual void OnClearServerDataSucceeded();
287 virtual void OnEncryptionComplete( 286 virtual void OnEncryptionComplete(
288 const syncable::ModelTypeSet& encrypted_types); 287 const syncable::ModelTypeSet& encrypted_types);
289 288
290 // JsBackend implementation. 289 // JsBackend implementation.
291 virtual void SetParentJsEventRouter(JsEventRouter* router); 290 virtual void SetParentJsEventRouter(JsEventRouter* router);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 void DoRequestClearServerData(); 348 void DoRequestClearServerData();
350 349
351 // Sets |deferred_nudge_for_cleanup_requested_| to true. See comment below. 350 // Sets |deferred_nudge_for_cleanup_requested_| to true. See comment below.
352 void DeferNudgeForCleanup(); 351 void DeferNudgeForCleanup();
353 352
354 // Called on our SyncBackendHost's |core_thread_| to set the passphrase 353 // Called on our SyncBackendHost's |core_thread_| to set the passphrase
355 // on behalf of SyncBackendHost::SupplyPassphrase. 354 // on behalf of SyncBackendHost::SupplyPassphrase.
356 void DoSetPassphrase(const std::string& passphrase, bool is_explicit); 355 void DoSetPassphrase(const std::string& passphrase, bool is_explicit);
357 356
358 // Getter/setter for whether we are waiting on SetPassphrase to process a 357 // Getter/setter for whether we are waiting on SetPassphrase to process a
359 // passphrase. Set by SetPassphrase, cleared by OnPassphraseFailed or 358 // passphrase. Set by SetPassphrase, cleared by OnPassphraseRequired or
360 // OnPassphraseAccepted. 359 // OnPassphraseAccepted.
361 bool processing_passphrase() const; 360 bool processing_passphrase() const;
362 void set_processing_passphrase(); 361 void set_processing_passphrase();
363 362
364 // Called on SyncBackendHost's |core_thread_| to set the datatypes we need 363 // Called on SyncBackendHost's |core_thread_| to set the datatypes we need
365 // to encrypt as well as encrypt all local data of that type. 364 // to encrypt as well as encrypt all local data of that type.
366 void DoEncryptDataTypes(const syncable::ModelTypeSet& encrypted_types); 365 void DoEncryptDataTypes(const syncable::ModelTypeSet& encrypted_types);
367 366
368 // The shutdown order is a bit complicated: 367 // The shutdown order is a bit complicated:
369 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final 368 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // off as soon as the SyncManager tells us it completed 442 // off as soon as the SyncManager tells us it completed
444 // initialization. 443 // initialization.
445 void SaveChanges(); 444 void SaveChanges();
446 445
447 // Dispatched to from HandleAuthErrorEventOnCoreLoop to handle updating 446 // Dispatched to from HandleAuthErrorEventOnCoreLoop to handle updating
448 // frontend UI components. 447 // frontend UI components.
449 void HandleAuthErrorEventOnFrontendLoop( 448 void HandleAuthErrorEventOnFrontendLoop(
450 const GoogleServiceAuthError& new_auth_error); 449 const GoogleServiceAuthError& new_auth_error);
451 450
452 // Invoked when a passphrase is required to decrypt a set of Nigori keys, 451 // Invoked when a passphrase is required to decrypt a set of Nigori keys,
453 // or for encrypting. If the reason is decryption, |for_decryption| will 452 // or for encrypting. |reason| denotes why the passhrase was required.
454 // be true. 453 void NotifyPassphraseRequired(sync_api::PassphraseRequiredReason reason);
455 void NotifyPassphraseRequired(bool for_decryption);
456
457 // Invoked when the syncer attempts to set a passphrase but fails to decrypt
458 // the cryptographer's pending keys. This tells the profile sync service
459 // that a new passphrase is required.
460 void NotifyPassphraseFailed();
461 454
462 // Invoked when the passphrase provided by the user has been accepted. 455 // Invoked when the passphrase provided by the user has been accepted.
463 void NotifyPassphraseAccepted(const std::string& bootstrap_token); 456 void NotifyPassphraseAccepted(const std::string& bootstrap_token);
464 457
465 // Invoked when an updated token is available from the sync server. 458 // Invoked when an updated token is available from the sync server.
466 void NotifyUpdatedToken(const std::string& token); 459 void NotifyUpdatedToken(const std::string& token);
467 460
468 // Invoked when sync finishes encrypting new datatypes or has become aware 461 // Invoked when sync finishes encrypting new datatypes or has become aware
469 // of new datatypes requiring encryption. 462 // of new datatypes requiring encryption.
470 void NotifyEncryptionComplete(const syncable::ModelTypeSet& 463 void NotifyEncryptionComplete(const syncable::ModelTypeSet&
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 638
646 // Whether we've processed the initialization complete callback. 639 // Whether we've processed the initialization complete callback.
647 bool syncapi_initialized_; 640 bool syncapi_initialized_;
648 641
649 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 642 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
650 }; 643 };
651 644
652 } // namespace browser_sync 645 } // namespace browser_sync
653 646
654 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 647 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698