| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "components/sync_driver/startup_controller.h" | 37 #include "components/sync_driver/startup_controller.h" |
| 38 #include "components/sync_driver/sync_frontend.h" | 38 #include "components/sync_driver/sync_frontend.h" |
| 39 #include "components/sync_driver/sync_prefs.h" | 39 #include "components/sync_driver/sync_prefs.h" |
| 40 #include "components/sync_driver/sync_service.h" | 40 #include "components/sync_driver/sync_service.h" |
| 41 #include "components/sync_driver/sync_stopped_reporter.h" | 41 #include "components/sync_driver/sync_stopped_reporter.h" |
| 42 #include "google_apis/gaia/google_service_auth_error.h" | 42 #include "google_apis/gaia/google_service_auth_error.h" |
| 43 #include "google_apis/gaia/oauth2_token_service.h" | 43 #include "google_apis/gaia/oauth2_token_service.h" |
| 44 #include "net/base/backoff_entry.h" | 44 #include "net/base/backoff_entry.h" |
| 45 #include "sync/internal_api/public/base/model_type.h" | 45 #include "sync/internal_api/public/base/model_type.h" |
| 46 #include "sync/internal_api/public/engine/model_safe_worker.h" | 46 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 47 #include "sync/internal_api/public/network_time_update_callback.h" |
| 47 #include "sync/internal_api/public/shutdown_reason.h" | 48 #include "sync/internal_api/public/shutdown_reason.h" |
| 48 #include "sync/internal_api/public/sync_manager_factory.h" | 49 #include "sync/internal_api/public/sync_manager_factory.h" |
| 49 #include "sync/internal_api/public/user_share.h" | 50 #include "sync/internal_api/public/user_share.h" |
| 50 #include "sync/internal_api/public/util/experiments.h" | 51 #include "sync/internal_api/public/util/experiments.h" |
| 51 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 52 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 52 #include "sync/js/sync_js_controller.h" | 53 #include "sync/js/sync_js_controller.h" |
| 53 #include "url/gurl.h" | 54 #include "url/gurl.h" |
| 54 | 55 |
| 55 class Profile; | 56 class Profile; |
| 56 class ProfileOAuth2TokenService; | 57 class ProfileOAuth2TokenService; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 BACKUP, // Backend for backup. | 227 BACKUP, // Backend for backup. |
| 227 ROLLBACK // Backend for rollback. | 228 ROLLBACK // Backend for rollback. |
| 228 }; | 229 }; |
| 229 | 230 |
| 230 // Takes ownership of |factory| and |signin_wrapper|. | 231 // Takes ownership of |factory| and |signin_wrapper|. |
| 231 ProfileSyncService( | 232 ProfileSyncService( |
| 232 scoped_ptr<sync_driver::SyncClient> sync_client, | 233 scoped_ptr<sync_driver::SyncClient> sync_client, |
| 233 Profile* profile, | 234 Profile* profile, |
| 234 scoped_ptr<SigninManagerWrapper> signin_wrapper, | 235 scoped_ptr<SigninManagerWrapper> signin_wrapper, |
| 235 ProfileOAuth2TokenService* oauth2_token_service, | 236 ProfileOAuth2TokenService* oauth2_token_service, |
| 236 browser_sync::ProfileSyncServiceStartBehavior start_behavior); | 237 browser_sync::ProfileSyncServiceStartBehavior start_behavior, |
| 238 const syncer::NetworkTimeUpdateCallback& network_time_update_callback); |
| 237 ~ProfileSyncService() override; | 239 ~ProfileSyncService() override; |
| 238 | 240 |
| 239 // Initializes the object. This must be called at most once, and | 241 // Initializes the object. This must be called at most once, and |
| 240 // immediately after an object of this class is constructed. | 242 // immediately after an object of this class is constructed. |
| 241 void Initialize(); | 243 void Initialize(); |
| 242 | 244 |
| 243 // sync_driver::SyncService implementation | 245 // sync_driver::SyncService implementation |
| 244 bool HasSyncSetupCompleted() const override; | 246 bool HasSyncSetupCompleted() const override; |
| 245 bool IsSyncAllowed() const override; | 247 bool IsSyncAllowed() const override; |
| 246 bool IsSyncActive() const override; | 248 bool IsSyncActive() const override; |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 794 |
| 793 // TODO(ncarter): Put this in a profile, once there is UI for it. | 795 // TODO(ncarter): Put this in a profile, once there is UI for it. |
| 794 // This specifies where to find the sync server. | 796 // This specifies where to find the sync server. |
| 795 const GURL sync_service_url_; | 797 const GURL sync_service_url_; |
| 796 | 798 |
| 797 // The time that OnConfigureStart is called. This member is zero if | 799 // The time that OnConfigureStart is called. This member is zero if |
| 798 // OnConfigureStart has not yet been called, and is reset to zero once | 800 // OnConfigureStart has not yet been called, and is reset to zero once |
| 799 // OnConfigureDone is called. | 801 // OnConfigureDone is called. |
| 800 base::Time sync_configure_start_time_; | 802 base::Time sync_configure_start_time_; |
| 801 | 803 |
| 804 // Callback to update the network time; used for initializing the backend. |
| 805 syncer::NetworkTimeUpdateCallback network_time_update_callback_; |
| 806 |
| 802 // Indicates if this is the first time sync is being configured. This value | 807 // Indicates if this is the first time sync is being configured. This value |
| 803 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized(). | 808 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized(). |
| 804 bool is_first_time_sync_configure_; | 809 bool is_first_time_sync_configure_; |
| 805 | 810 |
| 806 // List of available data type controllers. | 811 // List of available data type controllers. |
| 807 sync_driver::DataTypeController::TypeMap data_type_controllers_; | 812 sync_driver::DataTypeController::TypeMap data_type_controllers_; |
| 808 | 813 |
| 809 // Whether the SyncBackendHost has been initialized. | 814 // Whether the SyncBackendHost has been initialized. |
| 810 bool backend_initialized_; | 815 bool backend_initialized_; |
| 811 | 816 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; | 992 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; |
| 988 | 993 |
| 989 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 994 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 990 }; | 995 }; |
| 991 | 996 |
| 992 bool ShouldShowActionOnUI( | 997 bool ShouldShowActionOnUI( |
| 993 const syncer::SyncProtocolError& error); | 998 const syncer::SyncProtocolError& error); |
| 994 | 999 |
| 995 | 1000 |
| 996 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1001 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |