| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "google_apis/gaia/oauth2_token_service.h" | 41 #include "google_apis/gaia/oauth2_token_service.h" |
| 42 #include "net/base/backoff_entry.h" | 42 #include "net/base/backoff_entry.h" |
| 43 #include "sync/internal_api/public/base/model_type.h" | 43 #include "sync/internal_api/public/base/model_type.h" |
| 44 #include "sync/internal_api/public/engine/model_safe_worker.h" | 44 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 45 #include "sync/internal_api/public/sync_manager_factory.h" | 45 #include "sync/internal_api/public/sync_manager_factory.h" |
| 46 #include "sync/internal_api/public/util/experiments.h" | 46 #include "sync/internal_api/public/util/experiments.h" |
| 47 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 47 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 48 #include "sync/js/sync_js_controller.h" | 48 #include "sync/js/sync_js_controller.h" |
| 49 #include "url/gurl.h" | 49 #include "url/gurl.h" |
| 50 | 50 |
| 51 class ManagedUserSigninManagerWrapper; | |
| 52 class Profile; | 51 class Profile; |
| 53 class ProfileOAuth2TokenService; | 52 class ProfileOAuth2TokenService; |
| 54 class ProfileSyncComponentsFactory; | 53 class ProfileSyncComponentsFactory; |
| 55 class SigninManagerBase; | 54 class SigninManagerBase; |
| 56 class SyncGlobalError; | 55 class SyncGlobalError; |
| 57 | 56 |
| 58 namespace browser_sync { | 57 namespace browser_sync { |
| 59 class BackendMigrator; | 58 class BackendMigrator; |
| 60 class ChangeProcessor; | 59 class ChangeProcessor; |
| 61 class DataTypeManager; | 60 class DataTypeManager; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 DATATYPES_NOT_INITIALIZED, | 252 DATATYPES_NOT_INITIALIZED, |
| 254 INITIALIZED, | 253 INITIALIZED, |
| 255 UNKNOWN_ERROR, | 254 UNKNOWN_ERROR, |
| 256 }; | 255 }; |
| 257 | 256 |
| 258 // Default sync server URL. | 257 // Default sync server URL. |
| 259 static const char* kSyncServerUrl; | 258 static const char* kSyncServerUrl; |
| 260 // Sync server URL for dev channel users | 259 // Sync server URL for dev channel users |
| 261 static const char* kDevServerUrl; | 260 static const char* kDevServerUrl; |
| 262 | 261 |
| 263 // Takes ownership of |factory| and |signin_wrapper|. | 262 // Takes ownership of |factory|. |
| 264 ProfileSyncService(ProfileSyncComponentsFactory* factory, | 263 ProfileSyncService(ProfileSyncComponentsFactory* factory, |
| 265 Profile* profile, | 264 Profile* profile, |
| 266 ManagedUserSigninManagerWrapper* signin_wrapper, | 265 SigninManagerBase* signin, |
| 267 ProfileOAuth2TokenService* oauth2_token_service, | 266 ProfileOAuth2TokenService* oauth2_token_service, |
| 268 StartBehavior start_behavior); | 267 StartBehavior start_behavior); |
| 269 virtual ~ProfileSyncService(); | 268 virtual ~ProfileSyncService(); |
| 270 | 269 |
| 271 // Initializes the object. This must be called at most once, and | 270 // Initializes the object. This must be called at most once, and |
| 272 // immediately after an object of this class is constructed. | 271 // immediately after an object of this class is constructed. |
| 273 void Initialize(); | 272 void Initialize(); |
| 274 | 273 |
| 275 virtual void SetSyncSetupCompleted(); | 274 virtual void SetSyncSetupCompleted(); |
| 276 | 275 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // this is based on the cryptographer's settings, so if the user has recently | 632 // this is based on the cryptographer's settings, so if the user has recently |
| 634 // requested encryption to be turned on, this may not be true yet. For that, | 633 // requested encryption to be turned on, this may not be true yet. For that, |
| 635 // encryption_pending() must be checked. | 634 // encryption_pending() must be checked. |
| 636 virtual bool EncryptEverythingEnabled() const; | 635 virtual bool EncryptEverythingEnabled() const; |
| 637 | 636 |
| 638 // Returns true if the syncer is waiting for new datatypes to be encrypted. | 637 // Returns true if the syncer is waiting for new datatypes to be encrypted. |
| 639 virtual bool encryption_pending() const; | 638 virtual bool encryption_pending() const; |
| 640 | 639 |
| 641 const GURL& sync_service_url() const { return sync_service_url_; } | 640 const GURL& sync_service_url() const { return sync_service_url_; } |
| 642 bool auto_start_enabled() const { return auto_start_enabled_; } | 641 bool auto_start_enabled() const { return auto_start_enabled_; } |
| 643 SigninManagerBase* signin() const; | 642 SigninManagerBase* signin() const { return signin_; } |
| 644 bool setup_in_progress() const { return setup_in_progress_; } | 643 bool setup_in_progress() const { return setup_in_progress_; } |
| 645 | 644 |
| 646 // Stops the sync backend and sets the flag for suppressing sync startup. | 645 // Stops the sync backend and sets the flag for suppressing sync startup. |
| 647 void StopAndSuppress(); | 646 void StopAndSuppress(); |
| 648 | 647 |
| 649 // Resets the flag for suppressing sync startup and starts the sync backend. | 648 // Resets the flag for suppressing sync startup and starts the sync backend. |
| 650 virtual void UnsuppressAndStart(); | 649 virtual void UnsuppressAndStart(); |
| 651 | 650 |
| 652 // Marks all currently registered types as "acknowledged" so we won't prompt | 651 // Marks all currently registered types as "acknowledged" so we won't prompt |
| 653 // the user about them any more. | 652 // the user about them any more. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // ProfileSyncService from starting backend till browser restarted or user | 924 // ProfileSyncService from starting backend till browser restarted or user |
| 926 // signed out. | 925 // signed out. |
| 927 bool sync_disabled_by_admin_; | 926 bool sync_disabled_by_admin_; |
| 928 | 927 |
| 929 // Set to true if a signin has completed but we're still waiting for the | 928 // Set to true if a signin has completed but we're still waiting for the |
| 930 // backend to refresh its credentials. | 929 // backend to refresh its credentials. |
| 931 bool is_auth_in_progress_; | 930 bool is_auth_in_progress_; |
| 932 | 931 |
| 933 // Encapsulates user signin - used to set/get the user's authenticated | 932 // Encapsulates user signin - used to set/get the user's authenticated |
| 934 // email address. | 933 // email address. |
| 935 scoped_ptr<ManagedUserSigninManagerWrapper> signin_; | 934 SigninManagerBase* signin_; |
| 936 | 935 |
| 937 // Information describing an unrecoverable error. | 936 // Information describing an unrecoverable error. |
| 938 UnrecoverableErrorReason unrecoverable_error_reason_; | 937 UnrecoverableErrorReason unrecoverable_error_reason_; |
| 939 std::string unrecoverable_error_message_; | 938 std::string unrecoverable_error_message_; |
| 940 tracked_objects::Location unrecoverable_error_location_; | 939 tracked_objects::Location unrecoverable_error_location_; |
| 941 | 940 |
| 942 // Manages the start and stop of the various data types. | 941 // Manages the start and stop of the various data types. |
| 943 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_; | 942 scoped_ptr<browser_sync::DataTypeManager> data_type_manager_; |
| 944 | 943 |
| 945 ObserverList<ProfileSyncServiceBase::Observer> observers_; | 944 ObserverList<ProfileSyncServiceBase::Observer> observers_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 scoped_ptr<syncer::NetworkResources> network_resources_; | 1040 scoped_ptr<syncer::NetworkResources> network_resources_; |
| 1042 | 1041 |
| 1043 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1042 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1044 }; | 1043 }; |
| 1045 | 1044 |
| 1046 bool ShouldShowActionOnUI( | 1045 bool ShouldShowActionOnUI( |
| 1047 const syncer::SyncProtocolError& error); | 1046 const syncer::SyncProtocolError& error); |
| 1048 | 1047 |
| 1049 | 1048 |
| 1050 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1049 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |