blob: 59bc76396e55ea38d3c74e64a19c6aa7bde9d577 [file] [log] [blame]
Marc Treibc18387c52018-11-12 12:28:061// 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
12namespace syncer {
13class SyncPrefs;
14}
15
16namespace browser_sync {
17
18class ProfileSyncService;
19
20class 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 Treibfac49552018-11-15 07:35:5824 ~SyncUserSettingsImpl() override;
Marc Treibc18387c52018-11-12 12:28:0625
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_