| 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> |
| 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" |
| 17 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/memory_coordinator_client.h" |
| 19 #include "base/memory/memory_pressure_listener.h" | 20 #include "base/memory/memory_pressure_listener.h" |
| 20 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 21 #include "base/observer_list.h" | 22 #include "base/observer_list.h" |
| 22 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 23 #include "base/threading/thread_checker.h" | 24 #include "base/threading/thread_checker.h" |
| 24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 25 #include "base/timer/timer.h" | 26 #include "base/timer/timer.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 27 #include "components/keyed_service/core/keyed_service.h" | 28 #include "components/keyed_service/core/keyed_service.h" |
| 28 #include "components/signin/core/browser/gaia_cookie_manager_service.h" | 29 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // datatype configuration can begin. | 181 // datatype configuration can begin. |
| 181 class ProfileSyncService : public sync_driver::SyncService, | 182 class ProfileSyncService : public sync_driver::SyncService, |
| 182 public sync_driver::SyncFrontend, | 183 public sync_driver::SyncFrontend, |
| 183 public sync_driver::SyncPrefObserver, | 184 public sync_driver::SyncPrefObserver, |
| 184 public sync_driver::DataTypeManagerObserver, | 185 public sync_driver::DataTypeManagerObserver, |
| 185 public syncer::UnrecoverableErrorHandler, | 186 public syncer::UnrecoverableErrorHandler, |
| 186 public KeyedService, | 187 public KeyedService, |
| 187 public OAuth2TokenService::Consumer, | 188 public OAuth2TokenService::Consumer, |
| 188 public OAuth2TokenService::Observer, | 189 public OAuth2TokenService::Observer, |
| 189 public SigninManagerBase::Observer, | 190 public SigninManagerBase::Observer, |
| 190 public GaiaCookieManagerService::Observer { | 191 public GaiaCookieManagerService::Observer, |
| 192 public base::MemoryCoordinatorClient { |
| 191 public: | 193 public: |
| 192 typedef SyncBackendHost::Status Status; | 194 typedef SyncBackendHost::Status Status; |
| 193 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider; | 195 typedef base::Callback<bool(void)> PlatformSyncAllowedProvider; |
| 194 | 196 |
| 195 enum SyncEventCodes { | 197 enum SyncEventCodes { |
| 196 MIN_SYNC_EVENT_CODE = 0, | 198 MIN_SYNC_EVENT_CODE = 0, |
| 197 | 199 |
| 198 // Events starting the sync service. | 200 // Events starting the sync service. |
| 199 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 201 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
| 200 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 202 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 NOT_REQUESTED_NOT_SETUP, // The user turned off sync and setup completed | 666 NOT_REQUESTED_NOT_SETUP, // The user turned off sync and setup completed |
| 665 // is false. Might indicate a stop-and-clear. | 667 // is false. Might indicate a stop-and-clear. |
| 666 NEEDS_CONFIRMATION, // The user must confirm sync settings. | 668 NEEDS_CONFIRMATION, // The user must confirm sync settings. |
| 667 IS_MANAGED, // Sync is disallowed by enterprise policy. | 669 IS_MANAGED, // Sync is disallowed by enterprise policy. |
| 668 NOT_ALLOWED_BY_PLATFORM, // Sync is disallowed by the platform. | 670 NOT_ALLOWED_BY_PLATFORM, // Sync is disallowed by the platform. |
| 669 SYNC_INITIAL_STATE_LIMIT | 671 SYNC_INITIAL_STATE_LIMIT |
| 670 }; | 672 }; |
| 671 | 673 |
| 672 friend class TestProfileSyncService; | 674 friend class TestProfileSyncService; |
| 673 | 675 |
| 676 // base::MemoryCoordinatorClient implementation: |
| 677 void OnMemoryStateChange(base::MemoryState state) override; |
| 678 |
| 679 void IncrementMemoryPressureWarningCount(); |
| 680 |
| 674 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use | 681 // Stops the sync engine. Does NOT set IsSyncRequested to false. Use |
| 675 // RequestStop for that. |data_fate| controls whether the local sync data is | 682 // RequestStop for that. |data_fate| controls whether the local sync data is |
| 676 // deleted or kept when the engine shuts down. | 683 // deleted or kept when the engine shuts down. |
| 677 void StopImpl(SyncStopDataFate data_fate); | 684 void StopImpl(SyncStopDataFate data_fate); |
| 678 | 685 |
| 679 // Update the last auth error and notify observers of error state. | 686 // Update the last auth error and notify observers of error state. |
| 680 void UpdateAuthErrorState(const GoogleServiceAuthError& error); | 687 void UpdateAuthErrorState(const GoogleServiceAuthError& error); |
| 681 | 688 |
| 682 // Puts the backend's sync scheduler into NORMAL mode. | 689 // Puts the backend's sync scheduler into NORMAL mode. |
| 683 // Called when configuration is complete. | 690 // Called when configuration is complete. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 base::WeakPtrFactory<ProfileSyncService> weak_factory_; | 1023 base::WeakPtrFactory<ProfileSyncService> weak_factory_; |
| 1017 | 1024 |
| 1018 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 1025 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 1019 }; | 1026 }; |
| 1020 | 1027 |
| 1021 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); | 1028 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); |
| 1022 | 1029 |
| 1023 } // namespace browser_sync | 1030 } // namespace browser_sync |
| 1024 | 1031 |
| 1025 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 1032 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |