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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 6902101: Refactor sync passphrase setup flow and fix passphrase tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test. Created 9 years, 8 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_PROFILE_SYNC_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // SyncFrontend implementation. 190 // SyncFrontend implementation.
191 virtual void OnBackendInitialized(); 191 virtual void OnBackendInitialized();
192 virtual void OnSyncCycleCompleted(); 192 virtual void OnSyncCycleCompleted();
193 virtual void OnAuthError(); 193 virtual void OnAuthError();
194 virtual void OnStopSyncingPermanently(); 194 virtual void OnStopSyncingPermanently();
195 virtual void OnClearServerDataFailed(); 195 virtual void OnClearServerDataFailed();
196 virtual void OnClearServerDataTimeout(); 196 virtual void OnClearServerDataTimeout();
197 virtual void OnClearServerDataSucceeded(); 197 virtual void OnClearServerDataSucceeded();
198 virtual void OnPassphraseRequired(bool for_decryption); 198 virtual void OnPassphraseRequired(bool for_decryption);
199 virtual void OnPassphraseAccepted(); 199 virtual void OnPassphraseAccepted();
200 virtual void OnPassphraseFailed();
200 virtual void OnEncryptionComplete( 201 virtual void OnEncryptionComplete(
201 const syncable::ModelTypeSet& encrypted_types); 202 const syncable::ModelTypeSet& encrypted_types);
202 virtual void OnMigrationNeededForTypes( 203 virtual void OnMigrationNeededForTypes(
203 const syncable::ModelTypeSet& types); 204 const syncable::ModelTypeSet& types);
204 205
205 // Called when a user enters credentials through UI. 206 // Called when a user enters credentials through UI.
206 virtual void OnUserSubmittedAuth(const std::string& username, 207 virtual void OnUserSubmittedAuth(const std::string& username,
207 const std::string& password, 208 const std::string& password,
208 const std::string& captcha, 209 const std::string& captcha,
209 const std::string& access_code); 210 const std::string& access_code);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 280 }
280 281
281 bool UIShouldDepictAuthInProgress() const { 282 bool UIShouldDepictAuthInProgress() const {
282 return is_auth_in_progress_; 283 return is_auth_in_progress_;
283 } 284 }
284 285
285 bool observed_passphrase_required() const { 286 bool observed_passphrase_required() const {
286 return observed_passphrase_required_; 287 return observed_passphrase_required_;
287 } 288 }
288 289
290 bool observed_passphrase_failed() const {
291 return observed_passphrase_failed_;
292 }
293
289 bool passphrase_required_for_decryption() const { 294 bool passphrase_required_for_decryption() const {
290 return passphrase_required_for_decryption_; 295 return passphrase_required_for_decryption_;
291 } 296 }
292 297
293 // Returns a user-friendly string form of last synced time (in minutes). 298 // Returns a user-friendly string form of last synced time (in minutes).
294 virtual string16 GetLastSyncedTimeString() const; 299 virtual string16 GetLastSyncedTimeString() const;
295 300
296 // Returns the authenticated username of the sync user, or empty if none 301 // Returns the authenticated username of the sync user, or empty if none
297 // exists. It will only exist if the authentication service provider (e.g 302 // exists. It will only exist if the authentication service provider (e.g
298 // GAIA) has confirmed the username is authentic. 303 // GAIA) has confirmed the username is authentic.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 // other threads. 511 // other threads.
507 scoped_ptr<browser_sync::SyncBackendHost> backend_; 512 scoped_ptr<browser_sync::SyncBackendHost> backend_;
508 513
509 // Cache of the last name the client attempted to authenticate. 514 // Cache of the last name the client attempted to authenticate.
510 std::string last_attempted_user_email_; 515 std::string last_attempted_user_email_;
511 516
512 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the 517 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the
513 // backend, telling us that it is safe to send a passphrase down ASAP. 518 // backend, telling us that it is safe to send a passphrase down ASAP.
514 bool observed_passphrase_required_; 519 bool observed_passphrase_required_;
515 520
521 // Keeps track of whether the cryptographer's pending keys were decrypted with
522 // the cached passphrase or not. If not, a new passphrase is required.
523 bool observed_passphrase_failed_;
524
516 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it 525 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it
517 // was required for decryption? 526 // was required for decryption?
518 bool passphrase_required_for_decryption_; 527 bool passphrase_required_for_decryption_;
519 528
520 // Is the user in a passphrase migration? 529 // Is the user in a passphrase migration?
521 bool passphrase_migration_in_progress_; 530 bool passphrase_migration_in_progress_;
522 531
523 private: 532 private:
524 friend class ProfileSyncServicePasswordTest; 533 friend class ProfileSyncServicePasswordTest;
525 friend class TestProfileSyncService; 534 friend class TestProfileSyncService;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // The set of encrypted types. This is updated whenever datatypes are 652 // The set of encrypted types. This is updated whenever datatypes are
644 // encrypted through the OnEncryptionComplete callback of SyncFrontend. 653 // encrypted through the OnEncryptionComplete callback of SyncFrontend.
645 syncable::ModelTypeSet encrypted_types_; 654 syncable::ModelTypeSet encrypted_types_;
646 655
647 scoped_ptr<browser_sync::BackendMigrator> migrator_; 656 scoped_ptr<browser_sync::BackendMigrator> migrator_;
648 657
649 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 658 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
650 }; 659 };
651 660
652 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 661 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698