OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // takes place, and the backend isn't initialized yet? | 312 // takes place, and the backend isn't initialized yet? |
313 virtual bool sync_initialized() const; | 313 virtual bool sync_initialized() const; |
314 virtual bool unrecoverable_error_detected() const; | 314 virtual bool unrecoverable_error_detected() const; |
315 const std::string& unrecoverable_error_message() { | 315 const std::string& unrecoverable_error_message() { |
316 return unrecoverable_error_message_; | 316 return unrecoverable_error_message_; |
317 } | 317 } |
318 tracked_objects::Location unrecoverable_error_location() { | 318 tracked_objects::Location unrecoverable_error_location() { |
319 return unrecoverable_error_location_; | 319 return unrecoverable_error_location_; |
320 } | 320 } |
321 | 321 |
322 // Tracks whether the user is currently authenticating or not. This is used | 322 // Reports whether the user is currently authenticating or not. This is used |
323 // by the sync_ui_util helper routines to allow the UI to properly display | 323 // by the sync_ui_util helper routines to allow the UI to properly display |
324 // an "authenticating..." status message instead of an auth error when we are | 324 // an "authenticating..." status message instead of an auth error when we are |
325 // in the process of trying to update credentials. | 325 // in the process of trying to update credentials. |
326 // TODO(atwilson): This state should reside up in the UI or in a profile- | 326 // TODO(atwilson): This state now resides in SigninManager - this method |
327 // specific SyncUIUtil object rather than in ProfileSyncService. | 327 // will be removed once we've cleaned up the callers. http://crbug.com/95269. |
328 virtual bool UIShouldDepictAuthInProgress() const; | 328 virtual bool UIShouldDepictAuthInProgress() const; |
329 virtual void SetUIShouldDepictAuthInProgress(bool auth_in_progress); | |
330 | 329 |
331 // Returns true if OnPassphraseRequired has been called for any reason. | 330 // Returns true if OnPassphraseRequired has been called for any reason. |
332 virtual bool IsPassphraseRequired() const; | 331 virtual bool IsPassphraseRequired() const; |
333 | 332 |
334 // Returns true if OnPassphraseRequired has been called for decryption and | 333 // Returns true if OnPassphraseRequired has been called for decryption and |
335 // we have an encrypted data type enabled. | 334 // we have an encrypted data type enabled. |
336 virtual bool IsPassphraseRequiredForDecryption() const; | 335 virtual bool IsPassphraseRequiredForDecryption() const; |
337 | 336 |
338 sync_api::PassphraseRequiredReason passphrase_required_reason() const { | 337 sync_api::PassphraseRequiredReason passphrase_required_reason() const { |
339 return passphrase_required_reason_; | 338 return passphrase_required_reason_; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 void AcknowledgeSyncedTypes(); | 507 void AcknowledgeSyncedTypes(); |
509 | 508 |
510 SyncGlobalError* sync_global_error() { return sync_global_error_.get(); } | 509 SyncGlobalError* sync_global_error() { return sync_global_error_.get(); } |
511 | 510 |
512 virtual const FailedDatatypesHandler& failed_datatypes_handler(); | 511 virtual const FailedDatatypesHandler& failed_datatypes_handler(); |
513 | 512 |
514 browser_sync::DataTypeManager::ConfigureStatus configure_status() { | 513 browser_sync::DataTypeManager::ConfigureStatus configure_status() { |
515 return configure_status_; | 514 return configure_status_; |
516 } | 515 } |
517 | 516 |
| 517 // If true, the ProfileSyncService has detected that a new GAIA signin has |
| 518 // succeeded, and is waiting for initialization to complete. This is used by |
| 519 // the UI to differentiate between a new auth error (encountered as part of |
| 520 // the initialization process) and a pre-existing auth error that just hasn't |
| 521 // been cleared yet. |
| 522 bool waiting_for_auth() const { return is_auth_in_progress_; } |
| 523 |
518 // ProfileKeyedService implementation. | 524 // ProfileKeyedService implementation. |
519 virtual void Shutdown() OVERRIDE; | 525 virtual void Shutdown() OVERRIDE; |
520 | 526 |
521 protected: | 527 protected: |
522 // Used by test classes that derive from ProfileSyncService. | 528 // Used by test classes that derive from ProfileSyncService. |
523 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 529 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
524 | 530 |
525 // Helper to install and configure a data type manager. | 531 // Helper to install and configure a data type manager. |
526 void ConfigureDataTypeManager(); | 532 void ConfigureDataTypeManager(); |
527 | 533 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 browser_sync::DataTypeManager::ConfigureResult result); | 613 browser_sync::DataTypeManager::ConfigureResult result); |
608 | 614 |
609 // Reconfigures the data type manager with the latest enabled types. | 615 // Reconfigures the data type manager with the latest enabled types. |
610 // Note: Does not initialize the backend if it is not already initialized. | 616 // Note: Does not initialize the backend if it is not already initialized. |
611 // This function needs to be called only after sync has been initialized | 617 // This function needs to be called only after sync has been initialized |
612 // (i.e.,only for reconfigurations). The reason we don't initialize the | 618 // (i.e.,only for reconfigurations). The reason we don't initialize the |
613 // backend is because if we had encountered an unrecoverable error we dont | 619 // backend is because if we had encountered an unrecoverable error we dont |
614 // want to startup once more. | 620 // want to startup once more. |
615 virtual void ReconfigureDatatypeManager(); | 621 virtual void ReconfigureDatatypeManager(); |
616 | 622 |
617 | |
618 // Time at which we begin an attempt a GAIA authorization. | |
619 base::TimeTicks auth_start_time_; | |
620 | |
621 // Time at which error UI is presented for the new tab page. | |
622 base::TimeTicks auth_error_time_; | |
623 | |
624 // Factory used to create various dependent objects. | 623 // Factory used to create various dependent objects. |
625 scoped_ptr<ProfileSyncComponentsFactory> factory_; | 624 scoped_ptr<ProfileSyncComponentsFactory> factory_; |
626 | 625 |
627 // The profile whose data we are synchronizing. | 626 // The profile whose data we are synchronizing. |
628 Profile* profile_; | 627 Profile* profile_; |
629 | 628 |
630 // The class that handles getting, setting, and persisting sync | 629 // The class that handles getting, setting, and persisting sync |
631 // preferences. | 630 // preferences. |
632 browser_sync::SyncPrefs sync_prefs_; | 631 browser_sync::SyncPrefs sync_prefs_; |
633 | 632 |
634 // TODO(ncarter): Put this in a profile, once there is UI for it. | 633 // TODO(ncarter): Put this in a profile, once there is UI for it. |
635 // This specifies where to find the sync server. | 634 // This specifies where to find the sync server. |
636 GURL sync_service_url_; | 635 GURL sync_service_url_; |
637 | 636 |
638 // The last time we detected a successful transition from SYNCING state. | 637 // The last time we detected a successful transition from SYNCING state. |
639 // Our backend notifies us whenever we should take a new snapshot. | 638 // Our backend notifies us whenever we should take a new snapshot. |
640 base::Time last_synced_time_; | 639 base::Time last_synced_time_; |
641 | 640 |
642 // List of available data type controllers. | 641 // List of available data type controllers. |
643 browser_sync::DataTypeController::TypeMap data_type_controllers_; | 642 browser_sync::DataTypeController::TypeMap data_type_controllers_; |
644 | 643 |
645 // Whether the SyncBackendHost has been initialized. | 644 // Whether the SyncBackendHost has been initialized. |
646 bool backend_initialized_; | 645 bool backend_initialized_; |
647 | 646 |
648 // Various pieces of UI query this value to determine if they should show | 647 // Set to true if a signin has completed but we're still waiting for the |
649 // an "Authenticating.." type of message. We are the only central place | 648 // backend to refresh its credentials. |
650 // all auth attempts funnel through, so it makes sense to provide this. | |
651 // As its name suggests, this should NOT be used for anything other than UI. | |
652 bool is_auth_in_progress_; | 649 bool is_auth_in_progress_; |
653 | 650 |
654 SyncSetupWizard wizard_; | 651 SyncSetupWizard wizard_; |
655 | 652 |
656 // Encapsulates user signin - used to set/get the user's authenticated | 653 // Encapsulates user signin - used to set/get the user's authenticated |
657 // email address. | 654 // email address. |
658 SigninManager* signin_; | 655 SigninManager* signin_; |
659 | 656 |
660 // True if an unrecoverable error (e.g. violation of an assumed invariant) | 657 // True if an unrecoverable error (e.g. violation of an assumed invariant) |
661 // occurred during syncer operation. This value should be checked before | 658 // occurred during syncer operation. This value should be checked before |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 browser_sync::DataTypeManager::ConfigureStatus configure_status_; | 738 browser_sync::DataTypeManager::ConfigureStatus configure_status_; |
742 | 739 |
743 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 740 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
744 }; | 741 }; |
745 | 742 |
746 bool ShouldShowActionOnUI( | 743 bool ShouldShowActionOnUI( |
747 const browser_sync::SyncProtocolError& error); | 744 const browser_sync::SyncProtocolError& error); |
748 | 745 |
749 | 746 |
750 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 747 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |