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

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: Remove OnPassphraseFailed; Plumb enum all the way through; Shave yak. 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 virtual void SetSyncSetupCompleted(); 188 virtual void SetSyncSetupCompleted();
189 189
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(sync_api::PassphraseRequiredReason reason);
199 virtual void OnPassphraseAccepted(); 199 virtual void OnPassphraseAccepted();
200 virtual void OnEncryptionComplete( 200 virtual void OnEncryptionComplete(
201 const syncable::ModelTypeSet& encrypted_types); 201 const syncable::ModelTypeSet& encrypted_types);
202 virtual void OnMigrationNeededForTypes( 202 virtual void OnMigrationNeededForTypes(
203 const syncable::ModelTypeSet& types); 203 const syncable::ModelTypeSet& types);
204 204
205 // Called when a user enters credentials through UI. 205 // Called when a user enters credentials through UI.
206 virtual void OnUserSubmittedAuth(const std::string& username, 206 virtual void OnUserSubmittedAuth(const std::string& username,
207 const std::string& password, 207 const std::string& password,
208 const std::string& captcha, 208 const std::string& captcha,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 279 }
280 280
281 bool UIShouldDepictAuthInProgress() const { 281 bool UIShouldDepictAuthInProgress() const {
282 return is_auth_in_progress_; 282 return is_auth_in_progress_;
283 } 283 }
284 284
285 bool observed_passphrase_required() const { 285 bool observed_passphrase_required() const {
286 return observed_passphrase_required_; 286 return observed_passphrase_required_;
287 } 287 }
288 288
289 bool passphrase_required_for_decryption() const { 289 sync_api::PassphraseRequiredReason passphrase_required_reason() const {
290 return passphrase_required_for_decryption_; 290 return passphrase_required_reason_;
291 } 291 }
292 292
293 // Returns a user-friendly string form of last synced time (in minutes). 293 // Returns a user-friendly string form of last synced time (in minutes).
294 virtual string16 GetLastSyncedTimeString() const; 294 virtual string16 GetLastSyncedTimeString() const;
295 295
296 // Returns the authenticated username of the sync user, or empty if none 296 // 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 297 // exists. It will only exist if the authentication service provider (e.g
298 // GAIA) has confirmed the username is authentic. 298 // GAIA) has confirmed the username is authentic.
299 virtual string16 GetAuthenticatedUsername() const; 299 virtual string16 GetAuthenticatedUsername() const;
300 300
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 scoped_ptr<browser_sync::SyncBackendHost> backend_; 507 scoped_ptr<browser_sync::SyncBackendHost> backend_;
508 508
509 // Cache of the last name the client attempted to authenticate. 509 // Cache of the last name the client attempted to authenticate.
510 std::string last_attempted_user_email_; 510 std::string last_attempted_user_email_;
511 511
512 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the 512 // 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. 513 // backend, telling us that it is safe to send a passphrase down ASAP.
514 bool observed_passphrase_required_; 514 bool observed_passphrase_required_;
515 515
516 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it 516 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it
517 // was required for decryption? 517 // was required for encryption, decryption with a cached passphrase, or
518 bool passphrase_required_for_decryption_; 518 // because a new passphrase is required?
519 sync_api::PassphraseRequiredReason passphrase_required_reason_;
519 520
520 // Is the user in a passphrase migration? 521 // Is the user in a passphrase migration?
521 bool passphrase_migration_in_progress_; 522 bool passphrase_migration_in_progress_;
522 523
523 private: 524 private:
524 friend class ProfileSyncServicePasswordTest; 525 friend class ProfileSyncServicePasswordTest;
525 friend class TestProfileSyncService; 526 friend class TestProfileSyncService;
526 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 527 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
527 528
528 // If |delete_sync_data_folder| is true, then this method will delete all 529 // If |delete_sync_data_folder| is true, then this method will delete all
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // The set of encrypted types. This is updated whenever datatypes are 644 // The set of encrypted types. This is updated whenever datatypes are
644 // encrypted through the OnEncryptionComplete callback of SyncFrontend. 645 // encrypted through the OnEncryptionComplete callback of SyncFrontend.
645 syncable::ModelTypeSet encrypted_types_; 646 syncable::ModelTypeSet encrypted_types_;
646 647
647 scoped_ptr<browser_sync::BackendMigrator> migrator_; 648 scoped_ptr<browser_sync::BackendMigrator> migrator_;
648 649
649 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 650 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
650 }; 651 };
651 652
652 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 653 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698