blob: c55006cc3a94c641e5f3c5dd7e83776145a6900c [file] [log] [blame]
sdefresneed27d86b2015-09-14 11:02:381// 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 Zhang3a3e8f62018-08-27 20:00:148#include <memory>
Johan Tibell26b550b2017-06-20 04:59:139
10#include "components/prefs/pref_value_store.h"
11
sdefresne0b1722f02015-09-14 18:12:1212class PrefStore;
sdefresneed27d86b2015-09-14 11:02:3813class Profile;
14
maxbogueea16ff412016-10-28 16:35:2915namespace sync_preferences {
sdefresne50c1e522015-09-18 09:47:5116class PrefServiceSyncable;
17}
18
maxbogueea16ff412016-10-28 16:35:2919// sync_preferences::PrefServiceSyncable is a PrefService with added integration
sdefresne50c1e522015-09-18 09:47:5120// 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.
sdefresneed27d86b2015-09-14 11:02:3823//
24// For this reason, Profile does not expose an accessor for the
maxbogueea16ff412016-10-28 16:35:2925// sync_preferences::PrefServiceSyncable type. Instead, you can use the
Ramin Halavati3d7322d2019-06-11 06:00:3726// utilities below to retrieve the sync_preferences::PrefServiceSyncable from a
27// Profile.
maxbogueea16ff412016-10-28 16:35:2928sync_preferences::PrefServiceSyncable* PrefServiceSyncableFromProfile(
sdefresne50c1e522015-09-18 09:47:5129 Profile* profile);
sdefresneed27d86b2015-09-14 11:02:3830
sdefresne0b1722f02015-09-14 18:12:1231// 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 Degros9d35fc572018-02-05 22:32:4535std::unique_ptr<sync_preferences::PrefServiceSyncable>
36CreateIncognitoPrefServiceSyncable(
maxbogueea16ff412016-10-28 16:35:2937 sync_preferences::PrefServiceSyncable* pref_service,
Ken Rockot8ecb33b2019-11-21 21:36:0438 PrefStore* incognito_extension_pref_store);
sdefresne0b1722f02015-09-14 18:12:1239
sdefresneed27d86b2015-09-14 11:02:3840#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_UTIL_H_