sdefresne | ed27d86b | 2015-09-14 11:02:38 | [diff] [blame] | 1 | // Copyright 2015 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 CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_ |
| 6 | #define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_ |
| 7 | |
Lei Zhang | 3a3e8f6 | 2018-08-27 20:00:14 | [diff] [blame] | 8 | #include <memory> |
Johan Tibell | 26b550b | 2017-06-20 04:59:13 | [diff] [blame] | 9 | |
| 10 | #include "components/prefs/pref_value_store.h" |
| 11 | |
sdefresne | 0b1722f0 | 2015-09-14 18:12:12 | [diff] [blame] | 12 | class PrefStore; |
sdefresne | ed27d86b | 2015-09-14 11:02:38 | [diff] [blame] | 13 | class Profile; |
| 14 | |
maxbogue | ea16ff41 | 2016-10-28 16:35:29 | [diff] [blame] | 15 | namespace sync_preferences { |
sdefresne | 50c1e52 | 2015-09-18 09:47:51 | [diff] [blame] | 16 | class PrefServiceSyncable; |
| 17 | } |
| 18 | |
maxbogue | ea16ff41 | 2016-10-28 16:35:29 | [diff] [blame] | 19 | // sync_preferences::PrefServiceSyncable is a PrefService with added integration |
sdefresne | 50c1e52 | 2015-09-18 09:47:51 | [diff] [blame] | 20 | // for sync, and knowledge of how to create an incognito PrefService. For code |
| 21 | // that does not need to know about the sync integration, you should use only |
| 22 | // the plain PrefService type. |
sdefresne | ed27d86b | 2015-09-14 11:02:38 | [diff] [blame] | 23 | // |
| 24 | // For this reason, Profile does not expose an accessor for the |
maxbogue | ea16ff41 | 2016-10-28 16:35:29 | [diff] [blame] | 25 | // sync_preferences::PrefServiceSyncable type. Instead, you can use the |
Ramin Halavati | 3d7322d | 2019-06-11 06:00:37 | [diff] [blame] | 26 | // utilities below to retrieve the sync_preferences::PrefServiceSyncable from a |
| 27 | // Profile. |
maxbogue | ea16ff41 | 2016-10-28 16:35:29 | [diff] [blame] | 28 | sync_preferences::PrefServiceSyncable* PrefServiceSyncableFromProfile( |
sdefresne | 50c1e52 | 2015-09-18 09:47:51 | [diff] [blame] | 29 | Profile* profile); |
sdefresne | ed27d86b | 2015-09-14 11:02:38 | [diff] [blame] | 30 | |
sdefresne | 0b1722f0 | 2015-09-14 18:12:12 | [diff] [blame] | 31 | // Creates an incognito copy of |pref_service| that shares most prefs but uses |
| 32 | // a fresh non-persistent overlay for the user pref store and an individual |
| 33 | // extension pref store (to cache the effective extension prefs for incognito |
| 34 | // windows). |
François Degros | 9d35fc57 | 2018-02-05 22:32:45 | [diff] [blame] | 35 | std::unique_ptr<sync_preferences::PrefServiceSyncable> |
| 36 | CreateIncognitoPrefServiceSyncable( |
maxbogue | ea16ff41 | 2016-10-28 16:35:29 | [diff] [blame] | 37 | sync_preferences::PrefServiceSyncable* pref_service, |
Ken Rockot | 8ecb33b | 2019-11-21 21:36:04 | [diff] [blame] | 38 | PrefStore* incognito_extension_pref_store); |
sdefresne | 0b1722f0 | 2015-09-14 18:12:12 | [diff] [blame] | 39 | |
sdefresne | ed27d86b | 2015-09-14 11:02:38 | [diff] [blame] | 40 | #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_ |