| 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_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 Loading... |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 tracked_objects::Location unrecoverable_error_location() { | 276 tracked_objects::Location unrecoverable_error_location() { |
| 277 return unrecoverable_error_location_.get() ? | 277 return unrecoverable_error_location_.get() ? |
| 278 *unrecoverable_error_location_.get() : tracked_objects::Location(); | 278 *unrecoverable_error_location_.get() : tracked_objects::Location(); |
| 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 // Returns true if OnPassphraseRequired has been called for any reason. |
| 286 return observed_passphrase_required_; | 286 bool ObservedPassphraseRequired() const { |
| 287 return passphrase_required_reason_ != |
| 288 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; |
| 287 } | 289 } |
| 288 | 290 |
| 289 bool passphrase_required_for_decryption() const { | 291 sync_api::PassphraseRequiredReason passphrase_required_reason() const { |
| 290 return passphrase_required_for_decryption_; | 292 return passphrase_required_reason_; |
| 291 } | 293 } |
| 292 | 294 |
| 293 // Returns a user-friendly string form of last synced time (in minutes). | 295 // Returns a user-friendly string form of last synced time (in minutes). |
| 294 virtual string16 GetLastSyncedTimeString() const; | 296 virtual string16 GetLastSyncedTimeString() const; |
| 295 | 297 |
| 296 // Returns the authenticated username of the sync user, or empty if none | 298 // 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 | 299 // exists. It will only exist if the authentication service provider (e.g |
| 298 // GAIA) has confirmed the username is authentic. | 300 // GAIA) has confirmed the username is authentic. |
| 299 virtual string16 GetAuthenticatedUsername() const; | 301 virtual string16 GetAuthenticatedUsername() const; |
| 300 | 302 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // service using this member. Captcha and error state are reflected. | 504 // service using this member. Captcha and error state are reflected. |
| 503 GoogleServiceAuthError last_auth_error_; | 505 GoogleServiceAuthError last_auth_error_; |
| 504 | 506 |
| 505 // Our asynchronous backend to communicate with sync components living on | 507 // Our asynchronous backend to communicate with sync components living on |
| 506 // other threads. | 508 // other threads. |
| 507 scoped_ptr<browser_sync::SyncBackendHost> backend_; | 509 scoped_ptr<browser_sync::SyncBackendHost> backend_; |
| 508 | 510 |
| 509 // Cache of the last name the client attempted to authenticate. | 511 // Cache of the last name the client attempted to authenticate. |
| 510 std::string last_attempted_user_email_; | 512 std::string last_attempted_user_email_; |
| 511 | 513 |
| 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. | |
| 514 bool observed_passphrase_required_; | |
| 515 | |
| 516 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it | 514 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it |
| 517 // was required for decryption? | 515 // was required for encryption, decryption with a cached passphrase, or |
| 518 bool passphrase_required_for_decryption_; | 516 // because a new passphrase is required? |
| 517 sync_api::PassphraseRequiredReason passphrase_required_reason_; |
| 519 | 518 |
| 520 // Is the user in a passphrase migration? | 519 // Is the user in a passphrase migration? |
| 521 bool passphrase_migration_in_progress_; | 520 bool passphrase_migration_in_progress_; |
| 522 | 521 |
| 523 private: | 522 private: |
| 524 friend class ProfileSyncServicePasswordTest; | 523 friend class ProfileSyncServicePasswordTest; |
| 525 friend class TestProfileSyncService; | 524 friend class TestProfileSyncService; |
| 526 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); | 525 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); |
| 527 | 526 |
| 528 // If |delete_sync_data_folder| is true, then this method will delete all | 527 // 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 Loading... |
| 643 // The set of encrypted types. This is updated whenever datatypes are | 642 // The set of encrypted types. This is updated whenever datatypes are |
| 644 // encrypted through the OnEncryptionComplete callback of SyncFrontend. | 643 // encrypted through the OnEncryptionComplete callback of SyncFrontend. |
| 645 syncable::ModelTypeSet encrypted_types_; | 644 syncable::ModelTypeSet encrypted_types_; |
| 646 | 645 |
| 647 scoped_ptr<browser_sync::BackendMigrator> migrator_; | 646 scoped_ptr<browser_sync::BackendMigrator> migrator_; |
| 648 | 647 |
| 649 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 648 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 650 }; | 649 }; |
| 651 | 650 |
| 652 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 651 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |