| 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_BROWSER_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 6 #define COMPONENTS_BROWSER_SYNC_BROWSER_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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 public syncer::UnrecoverableErrorHandler, | 185 public syncer::UnrecoverableErrorHandler, |
| 186 public KeyedService, | 186 public KeyedService, |
| 187 public OAuth2TokenService::Consumer, | 187 public OAuth2TokenService::Consumer, |
| 188 public OAuth2TokenService::Observer, | 188 public OAuth2TokenService::Observer, |
| 189 public SigninManagerBase::Observer, | 189 public SigninManagerBase::Observer, |
| 190 public GaiaCookieManagerService::Observer { | 190 public GaiaCookieManagerService::Observer { |
| 191 public: | 191 public: |
| 192 typedef browser_sync::SyncBackendHost::Status Status; | 192 typedef browser_sync::SyncBackendHost::Status Status; |
| 193 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider; | 193 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider; |
| 194 | 194 |
| 195 enum SyncEventCodes { | 195 enum SyncEventCodes { |
| 196 MIN_SYNC_EVENT_CODE = 0, | 196 MIN_SYNC_EVENT_CODE = 0, |
| 197 | 197 |
| 198 // Events starting the sync service. | 198 // Events starting the sync service. |
| 199 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 199 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
| 200 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 200 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
| 201 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. | 201 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. |
| 202 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. | 202 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. |
| 203 START_FROM_PROFILE_MENU = 5, // Sync was started from multiprofile menu. | 203 START_FROM_PROFILE_MENU = 5, // Sync was started from multiprofile menu. |
| 204 START_FROM_URL = 6, // Sync was started from a typed URL. | 204 START_FROM_URL = 6, // Sync was started from a typed URL. |
| 205 | 205 |
| 206 // Events regarding cancellation of the signon process of sync. | 206 // Events regarding cancellation of the signon process of sync. |
| 207 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting | 207 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting |
| 208 // username and password. | 208 // username and password. |
| 209 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. | 209 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. |
| 210 CANCEL_DURING_CONFIGURE = 12, // Cancelled before choosing data | 210 CANCEL_DURING_CONFIGURE = 12, // Cancelled before choosing data |
| 211 // types and clicking OK. | 211 // types and clicking OK. |
| 212 // Events resulting in the stoppage of sync service. | 212 // Events resulting in the stoppage of sync service. |
| 213 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. | 213 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. |
| 214 STOP_FROM_ADVANCED_DIALOG = 21, // Sync was stopped via advanced settings. | 214 STOP_FROM_ADVANCED_DIALOG = 21, // Sync was stopped via advanced settings. |
| 215 | 215 |
| 216 // Miscellaneous events caused by sync service. | 216 // Miscellaneous events caused by sync service. |
| 217 | 217 |
| 218 MAX_SYNC_EVENT_CODE | 218 MAX_SYNC_EVENT_CODE |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 enum SyncStatusSummary { | 221 enum SyncStatusSummary { |
| 222 UNRECOVERABLE_ERROR, | 222 UNRECOVERABLE_ERROR, |
| 223 NOT_ENABLED, | 223 NOT_ENABLED, |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // TODO(sync): This is only used in tests. Can we remove it? | 490 // TODO(sync): This is only used in tests. Can we remove it? |
| 491 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const; | 491 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const; |
| 492 | 492 |
| 493 // SyncPrefObserver implementation. | 493 // SyncPrefObserver implementation. |
| 494 void OnSyncManagedPrefChange(bool is_sync_managed) override; | 494 void OnSyncManagedPrefChange(bool is_sync_managed) override; |
| 495 | 495 |
| 496 // Changes which data types we're going to be syncing to |preferred_types|. | 496 // Changes which data types we're going to be syncing to |preferred_types|. |
| 497 // If it is running, the DataTypeManager will be instructed to reconfigure | 497 // If it is running, the DataTypeManager will be instructed to reconfigure |
| 498 // the sync backend so that exactly these datatypes are actively synced. See | 498 // the sync backend so that exactly these datatypes are actively synced. See |
| 499 // class comment for more on what it means for a datatype to be Preferred. | 499 // class comment for more on what it means for a datatype to be Preferred. |
| 500 virtual void ChangePreferredDataTypes( | 500 virtual void ChangePreferredDataTypes(syncer::ModelTypeSet preferred_types); |
| 501 syncer::ModelTypeSet preferred_types); | |
| 502 | 501 |
| 503 // Returns the set of types which are enforced programmatically and can not | 502 // Returns the set of types which are enforced programmatically and can not |
| 504 // be disabled by the user. | 503 // be disabled by the user. |
| 505 virtual syncer::ModelTypeSet GetForcedDataTypes() const; | 504 virtual syncer::ModelTypeSet GetForcedDataTypes() const; |
| 506 | 505 |
| 507 // Gets the set of all data types that could be allowed (the set that | 506 // Gets the set of all data types that could be allowed (the set that |
| 508 // should be advertised to the user). These will typically only change | 507 // should be advertised to the user). These will typically only change |
| 509 // via a command-line option. See class comment for more on what it means | 508 // via a command-line option. See class comment for more on what it means |
| 510 // for a datatype to be Registered. | 509 // for a datatype to be Registered. |
| 511 virtual syncer::ModelTypeSet GetRegisteredDataTypes() const; | 510 virtual syncer::ModelTypeSet GetRegisteredDataTypes() const; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 syncer::SyncCredentials GetCredentials(); | 612 syncer::SyncCredentials GetCredentials(); |
| 614 | 613 |
| 615 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler(); | 614 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler(); |
| 616 | 615 |
| 617 // Helper method for managing encryption UI. | 616 // Helper method for managing encryption UI. |
| 618 bool IsEncryptedDatatypeEnabled() const; | 617 bool IsEncryptedDatatypeEnabled() const; |
| 619 | 618 |
| 620 // Helper for OnUnrecoverableError. | 619 // Helper for OnUnrecoverableError. |
| 621 // TODO(tim): Use an enum for |delete_sync_database| here, in ShutdownImpl, | 620 // TODO(tim): Use an enum for |delete_sync_database| here, in ShutdownImpl, |
| 622 // and in SyncBackendHost::Shutdown. | 621 // and in SyncBackendHost::Shutdown. |
| 623 void OnUnrecoverableErrorImpl( | 622 void OnUnrecoverableErrorImpl(const tracked_objects::Location& from_here, |
| 624 const tracked_objects::Location& from_here, | 623 const std::string& message, |
| 625 const std::string& message, | 624 bool delete_sync_database); |
| 626 bool delete_sync_database); | |
| 627 | 625 |
| 628 // This is a cache of the last authentication response we received from the | 626 // This is a cache of the last authentication response we received from the |
| 629 // sync server. The UI queries this to display appropriate messaging to the | 627 // sync server. The UI queries this to display appropriate messaging to the |
| 630 // user. | 628 // user. |
| 631 GoogleServiceAuthError last_auth_error_; | 629 GoogleServiceAuthError last_auth_error_; |
| 632 | 630 |
| 633 // Our asynchronous backend to communicate with sync components living on | 631 // Our asynchronous backend to communicate with sync components living on |
| 634 // other threads. | 632 // other threads. |
| 635 std::unique_ptr<browser_sync::SyncBackendHost> backend_; | 633 std::unique_ptr<browser_sync::SyncBackendHost> backend_; |
| 636 | 634 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 base::ThreadChecker thread_checker_; | 1017 base::ThreadChecker thread_checker_; |
| 1020 | 1018 |
| 1021 // This weak factory invalidates its issued pointers when Sync is disabled. | 1019 // This weak factory invalidates its issued pointers when Sync is disabled. |
| 1022 base::WeakPtrFactory<ProfileSyncService> sync_enabled_weak_factory_; | 1020 base::WeakPtrFactory<ProfileSyncService> sync_enabled_weak_factory_; |
| 1023 | 1021 |
| 1024 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | 1022 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 1025 | 1023 |
| 1026 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1024 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1027 }; | 1025 }; |
| 1028 | 1026 |
| 1029 bool ShouldShowActionOnUI( | 1027 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); |
| 1030 const syncer::SyncProtocolError& error); | |
| 1031 | 1028 |
| 1032 | 1029 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 1033 #endif // COMPONENTS_BROWSER_SYNC_BROWSER_PROFILE_SYNC_SERVICE_H_ | |
| OLD | NEW |