| 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 CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 6 #define CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 public: | 49 public: |
| 50 // |pref_service| may be NULL (for unit tests), but in that case no | 50 // |pref_service| may be NULL (for unit tests), but in that case no |
| 51 // setter methods should be called. Does not take ownership of | 51 // setter methods should be called. Does not take ownership of |
| 52 // |pref_service|. | 52 // |pref_service|. |
| 53 explicit SyncPrefs(PrefService* pref_service); | 53 explicit SyncPrefs(PrefService* pref_service); |
| 54 | 54 |
| 55 virtual ~SyncPrefs(); | 55 virtual ~SyncPrefs(); |
| 56 | 56 |
| 57 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 57 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 58 | 58 |
| 59 // Checks if sync is enabled for the profile that owns |io_data|. This must | |
| 60 // be invoked on the IO thread, and can be used to check if sync is enabled | |
| 61 // on that thread. | |
| 62 static bool IsSyncAccessibleOnIOThread(ProfileIOData* io_data); | |
| 63 | |
| 64 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); | 59 void AddSyncPrefObserver(SyncPrefObserver* sync_pref_observer); |
| 65 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer); | 60 void RemoveSyncPrefObserver(SyncPrefObserver* sync_pref_observer); |
| 66 | 61 |
| 67 // Clears important sync preferences. | 62 // Clears important sync preferences. |
| 68 void ClearPreferences(); | 63 void ClearPreferences(); |
| 69 | 64 |
| 70 // Getters and setters for global sync prefs. | 65 // Getters and setters for global sync prefs. |
| 71 | 66 |
| 72 bool HasSyncSetupCompleted() const; | 67 bool HasSyncSetupCompleted() const; |
| 73 void SetSyncSetupCompleted(); | 68 void SetSyncSetupCompleted(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 94 // Changes are still made to the prefs even if | 89 // Changes are still made to the prefs even if |
| 95 // HasKeepEverythingSynced() is true, but won't be visible until | 90 // HasKeepEverythingSynced() is true, but won't be visible until |
| 96 // SetKeepEverythingSynced(false) is called. | 91 // SetKeepEverythingSynced(false) is called. |
| 97 void SetPreferredDataTypes( | 92 void SetPreferredDataTypes( |
| 98 syncer::ModelTypeSet registered_types, | 93 syncer::ModelTypeSet registered_types, |
| 99 syncer::ModelTypeSet preferred_types); | 94 syncer::ModelTypeSet preferred_types); |
| 100 | 95 |
| 101 // This pref is set outside of sync. | 96 // This pref is set outside of sync. |
| 102 bool IsManaged() const; | 97 bool IsManaged() const; |
| 103 | 98 |
| 99 // IsSyncDisabledByAdmin has the same meaning as IsManaged: sync is disabled |
| 100 // for accounts by domain admin. IsSyncDisabledByAdmin is set to true when |
| 101 // sync server returns DISABLED_BY_ADMIN in ClientToServerResponse. This pref |
| 102 // setting caches the value in order to display settings page correctly. |
| 103 // It is not required to initialise sync backend to display state of sync |
| 104 // buttons on settings page. |
| 105 bool IsSyncDisabledByAdmin() const; |
| 106 void SetSyncDisabledByAdmin(bool value); |
| 107 |
| 104 // Use this encryption bootstrap token if we're using an explicit passphrase. | 108 // Use this encryption bootstrap token if we're using an explicit passphrase. |
| 105 std::string GetEncryptionBootstrapToken() const; | 109 std::string GetEncryptionBootstrapToken() const; |
| 106 void SetEncryptionBootstrapToken(const std::string& token); | 110 void SetEncryptionBootstrapToken(const std::string& token); |
| 107 | 111 |
| 108 // Use this keystore bootstrap token if we're not using an explicit | 112 // Use this keystore bootstrap token if we're not using an explicit |
| 109 // passphrase. | 113 // passphrase. |
| 110 std::string GetKeystoreEncryptionBootstrapToken() const; | 114 std::string GetKeystoreEncryptionBootstrapToken() const; |
| 111 void SetKeystoreEncryptionBootstrapToken(const std::string& token); | 115 void SetKeystoreEncryptionBootstrapToken(const std::string& token); |
| 112 | 116 |
| 113 // Use this for the unique machine tag used for session sync. | 117 // Use this for the unique machine tag used for session sync. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // etc. | 170 // etc. |
| 167 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap; | 171 typedef std::map<syncer::ModelType, syncer::ModelTypeSet> PrefGroupsMap; |
| 168 PrefGroupsMap pref_groups_; | 172 PrefGroupsMap pref_groups_; |
| 169 | 173 |
| 170 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 174 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |
| 171 }; | 175 }; |
| 172 | 176 |
| 173 } // namespace browser_sync | 177 } // namespace browser_sync |
| 174 | 178 |
| 175 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ | 179 #endif // CHROME_BROWSER_SYNC_SYNC_PREFS_H_ |
| OLD | NEW |