Marc Treib | c18387c5 | 2018-11-12 12:28:06 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef COMPONENTS_BROWSER_SYNC_SYNC_USER_SETTINGS_IMPL_H_ |
| 6 | #define COMPONENTS_BROWSER_SYNC_SYNC_USER_SETTINGS_IMPL_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "components/sync/driver/sync_user_settings.h" |
| 11 | |
| 12 | namespace syncer { |
| 13 | class SyncPrefs; |
| 14 | } |
| 15 | |
| 16 | namespace browser_sync { |
| 17 | |
| 18 | class ProfileSyncService; |
| 19 | |
| 20 | class SyncUserSettingsImpl : public syncer::SyncUserSettings { |
| 21 | public: |
| 22 | // Both |service| and |prefs| must not be null, and must outlive this object. |
| 23 | SyncUserSettingsImpl(ProfileSyncService* service, syncer::SyncPrefs* prefs); |
Marc Treib | fac4955 | 2018-11-15 07:35:58 | [diff] [blame] | 24 | ~SyncUserSettingsImpl() override; |
Marc Treib | c18387c5 | 2018-11-12 12:28:06 | [diff] [blame] | 25 | |
| 26 | bool IsSyncRequested() const override; |
| 27 | void SetSyncRequested(bool requested) override; |
| 28 | |
| 29 | bool IsSyncAllowedByPlatform() const override; |
| 30 | void SetSyncAllowedByPlatform(bool allowed) override; |
| 31 | |
| 32 | bool IsFirstSetupComplete() const override; |
| 33 | void SetFirstSetupComplete() override; |
| 34 | |
| 35 | bool IsSyncEverythingEnabled() const override; |
| 36 | syncer::ModelTypeSet GetChosenDataTypes() const override; |
| 37 | void SetChosenDataTypes(bool sync_everything, |
| 38 | syncer::ModelTypeSet types) override; |
| 39 | |
| 40 | bool IsEncryptEverythingAllowed() const override; |
| 41 | void SetEncryptEverythingAllowed(bool allowed) override; |
| 42 | bool IsEncryptEverythingEnabled() const override; |
| 43 | void EnableEncryptEverything() override; |
| 44 | |
| 45 | bool IsPassphraseRequired() const override; |
| 46 | bool IsPassphraseRequiredForDecryption() const override; |
| 47 | bool IsUsingSecondaryPassphrase() const override; |
| 48 | base::Time GetExplicitPassphraseTime() const override; |
| 49 | syncer::PassphraseType GetPassphraseType() const override; |
| 50 | |
| 51 | void SetEncryptionPassphrase(const std::string& passphrase) override; |
| 52 | bool SetDecryptionPassphrase(const std::string& passphrase) override; |
| 53 | |
| 54 | private: |
| 55 | ProfileSyncService* const service_; |
| 56 | syncer::SyncPrefs* const prefs_; |
| 57 | |
| 58 | // Whether sync is currently allowed on this platform. |
| 59 | bool sync_allowed_by_platform_ = true; |
| 60 | }; |
| 61 | |
| 62 | } // namespace browser_sync |
| 63 | |
| 64 | #endif // COMPONENTS_BROWSER_SYNC_SYNC_USER_SETTINGS_IMPL_H_ |