| 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 COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "components/sync/driver/sync_service_base.h" | 42 #include "components/sync/driver/sync_service_base.h" |
| 43 #include "components/sync/driver/sync_stopped_reporter.h" | 43 #include "components/sync/driver/sync_stopped_reporter.h" |
| 44 #include "components/sync/engine/events/protocol_event_observer.h" | 44 #include "components/sync/engine/events/protocol_event_observer.h" |
| 45 #include "components/sync/engine/model_safe_worker.h" | 45 #include "components/sync/engine/model_safe_worker.h" |
| 46 #include "components/sync/engine/net/network_time_update_callback.h" | 46 #include "components/sync/engine/net/network_time_update_callback.h" |
| 47 #include "components/sync/engine/shutdown_reason.h" | 47 #include "components/sync/engine/shutdown_reason.h" |
| 48 #include "components/sync/engine/sync_engine.h" | 48 #include "components/sync/engine/sync_engine.h" |
| 49 #include "components/sync/engine/sync_engine_host.h" | 49 #include "components/sync/engine/sync_engine_host.h" |
| 50 #include "components/sync/engine/sync_manager_factory.h" | 50 #include "components/sync/engine/sync_manager_factory.h" |
| 51 #include "components/sync/js/sync_js_controller.h" | 51 #include "components/sync/js/sync_js_controller.h" |
| 52 #include "components/sync/model/model_type_store.h" |
| 52 #include "components/sync/syncable/user_share.h" | 53 #include "components/sync/syncable/user_share.h" |
| 53 #include "components/version_info/version_info.h" | 54 #include "components/version_info/version_info.h" |
| 54 #include "google_apis/gaia/google_service_auth_error.h" | 55 #include "google_apis/gaia/google_service_auth_error.h" |
| 55 #include "google_apis/gaia/oauth2_token_service.h" | 56 #include "google_apis/gaia/oauth2_token_service.h" |
| 56 #include "net/base/backoff_entry.h" | 57 #include "net/base/backoff_entry.h" |
| 57 #include "url/gurl.h" | 58 #include "url/gurl.h" |
| 58 | 59 |
| 59 class Profile; | 60 class Profile; |
| 60 class ProfileOAuth2TokenService; | 61 class ProfileOAuth2TokenService; |
| 61 class SigninManagerWrapper; | 62 class SigninManagerWrapper; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 std::unique_ptr<syncer::SyncClient> sync_client; | 238 std::unique_ptr<syncer::SyncClient> sync_client; |
| 238 std::unique_ptr<SigninManagerWrapper> signin_wrapper; | 239 std::unique_ptr<SigninManagerWrapper> signin_wrapper; |
| 239 ProfileOAuth2TokenService* oauth2_token_service = nullptr; | 240 ProfileOAuth2TokenService* oauth2_token_service = nullptr; |
| 240 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr; | 241 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr; |
| 241 StartBehavior start_behavior = MANUAL_START; | 242 StartBehavior start_behavior = MANUAL_START; |
| 242 syncer::NetworkTimeUpdateCallback network_time_update_callback; | 243 syncer::NetworkTimeUpdateCallback network_time_update_callback; |
| 243 base::FilePath base_directory; | 244 base::FilePath base_directory; |
| 244 scoped_refptr<net::URLRequestContextGetter> url_request_context; | 245 scoped_refptr<net::URLRequestContextGetter> url_request_context; |
| 245 std::string debug_identifier; | 246 std::string debug_identifier; |
| 246 version_info::Channel channel = version_info::Channel::UNKNOWN; | 247 version_info::Channel channel = version_info::Channel::UNKNOWN; |
| 247 base::SequencedWorkerPool* blocking_pool = nullptr; | 248 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner; |
| 248 base::FilePath local_sync_backend_folder; | 249 base::FilePath local_sync_backend_folder; |
| 249 | 250 |
| 250 private: | 251 private: |
| 251 DISALLOW_COPY_AND_ASSIGN(InitParams); | 252 DISALLOW_COPY_AND_ASSIGN(InitParams); |
| 252 }; | 253 }; |
| 253 | 254 |
| 254 explicit ProfileSyncService(InitParams init_params); | 255 explicit ProfileSyncService(InitParams init_params); |
| 255 | 256 |
| 256 ~ProfileSyncService() override; | 257 ~ProfileSyncService() override; |
| 257 | 258 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 void FlushDirectory() const; | 574 void FlushDirectory() const; |
| 574 | 575 |
| 575 // Returns a serialized NigoriKey proto generated from the bootstrap token in | 576 // Returns a serialized NigoriKey proto generated from the bootstrap token in |
| 576 // SyncPrefs. Will return the empty string if no bootstrap token exists. | 577 // SyncPrefs. Will return the empty string if no bootstrap token exists. |
| 577 std::string GetCustomPassphraseKey() const; | 578 std::string GetCustomPassphraseKey() const; |
| 578 | 579 |
| 579 // Set the provider for whether sync is currently allowed by the platform. | 580 // Set the provider for whether sync is currently allowed by the platform. |
| 580 void SetPlatformSyncAllowedProvider( | 581 void SetPlatformSyncAllowedProvider( |
| 581 const PlatformSyncAllowedProvider& platform_sync_allowed_provider); | 582 const PlatformSyncAllowedProvider& platform_sync_allowed_provider); |
| 582 | 583 |
| 584 // Returns a function for |type| that will create a ModelTypeStore that shares |
| 585 // the sync LevelDB backend. |
| 586 syncer::ModelTypeStoreFactory GetModelTypeStoreFactory( |
| 587 syncer::ModelType type); |
| 588 |
| 583 // Needed to test whether the directory is deleted properly. | 589 // Needed to test whether the directory is deleted properly. |
| 584 base::FilePath GetDirectoryPathForTest() const; | 590 base::FilePath GetDirectoryPathForTest() const; |
| 585 | 591 |
| 586 // Sometimes we need to wait for tasks on the sync thread in tests. | 592 // Sometimes we need to wait for tasks on the sync thread in tests. |
| 587 base::MessageLoop* GetSyncLoopForTest() const; | 593 base::MessageLoop* GetSyncLoopForTest() const; |
| 588 | 594 |
| 589 // Triggers sync cycle with request to update specified |types|. | 595 // Triggers sync cycle with request to update specified |types|. |
| 590 void RefreshTypesForTest(syncer::ModelTypeSet types); | 596 void RefreshTypesForTest(syncer::ModelTypeSet types); |
| 591 | 597 |
| 592 protected: | 598 protected: |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 // OnConfigureStart has not yet been called, and is reset to zero once | 792 // OnConfigureStart has not yet been called, and is reset to zero once |
| 787 // OnConfigureDone is called. | 793 // OnConfigureDone is called. |
| 788 base::Time sync_configure_start_time_; | 794 base::Time sync_configure_start_time_; |
| 789 | 795 |
| 790 // Callback to update the network time; used for initializing the engine. | 796 // Callback to update the network time; used for initializing the engine. |
| 791 syncer::NetworkTimeUpdateCallback network_time_update_callback_; | 797 syncer::NetworkTimeUpdateCallback network_time_update_callback_; |
| 792 | 798 |
| 793 // The request context in which sync should operate. | 799 // The request context in which sync should operate. |
| 794 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 800 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
| 795 | 801 |
| 796 // Threading context. | 802 // The task runner to use for blocking IO operations. |
| 797 base::SequencedWorkerPool* blocking_pool_; | 803 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 798 | 804 |
| 799 // Indicates if this is the first time sync is being configured. This value | 805 // Indicates if this is the first time sync is being configured. This value |
| 800 // is equal to !IsFirstSetupComplete() at the time of OnEngineInitialized(). | 806 // is equal to !IsFirstSetupComplete() at the time of OnEngineInitialized(). |
| 801 bool is_first_time_sync_configure_; | 807 bool is_first_time_sync_configure_; |
| 802 | 808 |
| 803 // Number of UIs currently configuring the Sync service. When this number | 809 // Number of UIs currently configuring the Sync service. When this number |
| 804 // is decremented back to zero, Sync setup is marked no longer in progress. | 810 // is decremented back to zero, Sync setup is marked no longer in progress. |
| 805 int outstanding_setup_in_progress_handles_ = 0; | 811 int outstanding_setup_in_progress_handles_ = 0; |
| 806 | 812 |
| 807 // List of available data type controllers. | 813 // List of available data type controllers. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | 969 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 964 | 970 |
| 965 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 971 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 966 }; | 972 }; |
| 967 | 973 |
| 968 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); | 974 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); |
| 969 | 975 |
| 970 } // namespace browser_sync | 976 } // namespace browser_sync |
| 971 | 977 |
| 972 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 978 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |