| 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 21 matching lines...) Expand all Loading... |
| 32 #include "components/sync_driver/data_type_manager_observer.h" | 32 #include "components/sync_driver/data_type_manager_observer.h" |
| 33 #include "components/sync_driver/data_type_status_table.h" | 33 #include "components/sync_driver/data_type_status_table.h" |
| 34 #include "components/sync_driver/device_info_sync_service.h" | 34 #include "components/sync_driver/device_info_sync_service.h" |
| 35 #include "components/sync_driver/local_device_info_provider.h" | 35 #include "components/sync_driver/local_device_info_provider.h" |
| 36 #include "components/sync_driver/protocol_event_observer.h" | 36 #include "components/sync_driver/protocol_event_observer.h" |
| 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 "content/public/browser/notification_observer.h" |
| 43 #include "content/public/browser/notification_registrar.h" |
| 42 #include "google_apis/gaia/google_service_auth_error.h" | 44 #include "google_apis/gaia/google_service_auth_error.h" |
| 43 #include "google_apis/gaia/oauth2_token_service.h" | 45 #include "google_apis/gaia/oauth2_token_service.h" |
| 44 #include "net/base/backoff_entry.h" | 46 #include "net/base/backoff_entry.h" |
| 45 #include "sync/internal_api/public/base/model_type.h" | 47 #include "sync/internal_api/public/base/model_type.h" |
| 46 #include "sync/internal_api/public/engine/model_safe_worker.h" | 48 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 47 #include "sync/internal_api/public/network_time_update_callback.h" | 49 #include "sync/internal_api/public/network_time_update_callback.h" |
| 48 #include "sync/internal_api/public/shutdown_reason.h" | 50 #include "sync/internal_api/public/shutdown_reason.h" |
| 49 #include "sync/internal_api/public/sync_manager_factory.h" | 51 #include "sync/internal_api/public/sync_manager_factory.h" |
| 50 #include "sync/internal_api/public/user_share.h" | 52 #include "sync/internal_api/public/user_share.h" |
| 51 #include "sync/internal_api/public/util/experiments.h" | 53 #include "sync/internal_api/public/util/experiments.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will | 173 // SetSyncSetupCompleted() followed by SetSetupInProgress(false) - this will |
| 172 // tell the sync engine that setup is completed and it can begin downloading | 174 // tell the sync engine that setup is completed and it can begin downloading |
| 173 // data from the sync server. | 175 // data from the sync server. |
| 174 // | 176 // |
| 175 class ProfileSyncService : public sync_driver::SyncService, | 177 class ProfileSyncService : public sync_driver::SyncService, |
| 176 public sync_driver::SyncFrontend, | 178 public sync_driver::SyncFrontend, |
| 177 public sync_driver::SyncPrefObserver, | 179 public sync_driver::SyncPrefObserver, |
| 178 public sync_driver::DataTypeManagerObserver, | 180 public sync_driver::DataTypeManagerObserver, |
| 179 public syncer::UnrecoverableErrorHandler, | 181 public syncer::UnrecoverableErrorHandler, |
| 180 public KeyedService, | 182 public KeyedService, |
| 183 public content::NotificationObserver, |
| 181 public OAuth2TokenService::Consumer, | 184 public OAuth2TokenService::Consumer, |
| 182 public OAuth2TokenService::Observer, | 185 public OAuth2TokenService::Observer, |
| 183 public SigninManagerBase::Observer { | 186 public SigninManagerBase::Observer { |
| 184 public: | 187 public: |
| 185 typedef browser_sync::SyncBackendHost::Status Status; | 188 typedef browser_sync::SyncBackendHost::Status Status; |
| 186 | 189 |
| 187 enum SyncEventCodes { | 190 enum SyncEventCodes { |
| 188 MIN_SYNC_EVENT_CODE = 0, | 191 MIN_SYNC_EVENT_CODE = 0, |
| 189 | 192 |
| 190 // Events starting the sync service. | 193 // Events starting the sync service. |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 AUTH_ERROR_ENCOUNTERED, | 637 AUTH_ERROR_ENCOUNTERED, |
| 635 AUTH_ERROR_FIXED, | 638 AUTH_ERROR_FIXED, |
| 636 AUTH_ERROR_LIMIT | 639 AUTH_ERROR_LIMIT |
| 637 }; | 640 }; |
| 638 | 641 |
| 639 friend class ProfileSyncServicePasswordTest; | 642 friend class ProfileSyncServicePasswordTest; |
| 640 friend class SyncTest; | 643 friend class SyncTest; |
| 641 friend class TestProfileSyncService; | 644 friend class TestProfileSyncService; |
| 642 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); | 645 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); |
| 643 | 646 |
| 647 // Observe notifications. |
| 648 void Observe(int type, |
| 649 const content::NotificationSource& source, |
| 650 const content::NotificationDetails& details) override; |
| 651 |
| 644 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use | 652 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use |
| 645 // RequestStop for that. |data_fate| controls whether the local sync data is | 653 // RequestStop for that. |data_fate| controls whether the local sync data is |
| 646 // deleted or kept when the engine shuts down. | 654 // deleted or kept when the engine shuts down. |
| 647 void StopImpl(SyncStopDataFate data_fate); | 655 void StopImpl(SyncStopDataFate data_fate); |
| 648 | 656 |
| 649 // Update the last auth error and notify observers of error state. | 657 // Update the last auth error and notify observers of error state. |
| 650 void UpdateAuthErrorState(const GoogleServiceAuthError& error); | 658 void UpdateAuthErrorState(const GoogleServiceAuthError& error); |
| 651 | 659 |
| 652 // Detects and attempts to recover from a previous improper datatype | 660 // Detects and attempts to recover from a previous improper datatype |
| 653 // configuration where Keep Everything Synced and the preferred types were | 661 // configuration where Keep Everything Synced and the preferred types were |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 // to OnConfigureDone originated from BeginConfigureCatchUpBeforeClear and | 982 // to OnConfigureDone originated from BeginConfigureCatchUpBeforeClear and |
| 975 // needs to be followed by ClearAndRestartSyncForPassphraseEncryption(). | 983 // needs to be followed by ClearAndRestartSyncForPassphraseEncryption(). |
| 976 bool catch_up_configure_in_progress_; | 984 bool catch_up_configure_in_progress_; |
| 977 | 985 |
| 978 // Whether the major version has changed since the last time Chrome ran, | 986 // Whether the major version has changed since the last time Chrome ran, |
| 979 // and therefore a passphrase required state should result in prompting | 987 // and therefore a passphrase required state should result in prompting |
| 980 // the user. This logic is only enabled on platforms that consume the | 988 // the user. This logic is only enabled on platforms that consume the |
| 981 // IsPassphrasePrompted sync preference. | 989 // IsPassphrasePrompted sync preference. |
| 982 bool passphrase_prompt_triggered_by_version_; | 990 bool passphrase_prompt_triggered_by_version_; |
| 983 | 991 |
| 992 content::NotificationRegistrar registrar_; |
| 993 |
| 984 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | 994 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 985 | 995 |
| 986 // We don't use |weak_factory_| for the StartupController because the weak | 996 // We don't use |weak_factory_| for the StartupController because the weak |
| 987 // ptrs should be bound to the lifetime of ProfileSyncService and not to the | 997 // ptrs should be bound to the lifetime of ProfileSyncService and not to the |
| 988 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass | 998 // [Initialize -> sync disabled/shutdown] lifetime. We don't pass |
| 989 // StartupController an Unretained reference to future-proof against | 999 // StartupController an Unretained reference to future-proof against |
| 990 // the controller impl changing to post tasks. Therefore, we have a separate | 1000 // the controller impl changing to post tasks. Therefore, we have a separate |
| 991 // factory. | 1001 // factory. |
| 992 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; | 1002 base::WeakPtrFactory<ProfileSyncService> startup_controller_weak_factory_; |
| 993 | 1003 |
| 994 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1004 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 995 }; | 1005 }; |
| 996 | 1006 |
| 997 bool ShouldShowActionOnUI( | 1007 bool ShouldShowActionOnUI( |
| 998 const syncer::SyncProtocolError& error); | 1008 const syncer::SyncProtocolError& error); |
| 999 | 1009 |
| 1000 | 1010 |
| 1001 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1011 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |