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.
5 #ifndef IOS_CHROME_BROWSER_PREFS_IOS_CHROME_PREF_SERVICE_FACTORY_H_
6 #define IOS_CHROME_BROWSER_PREFS_IOS_CHROME_PREF_SERVICE_FACTORY_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
14 class TrackedPreferenceValidationDelegate
;
18 class SequencedTaskRunner
;
22 class ChromeBrowserState
;
29 namespace syncable_prefs
{
30 class PrefServiceSyncable
;
33 namespace user_prefs
{
34 class PrefRegistrySyncable
;
37 // Factory methods that create and initialize a new instance of a PrefService
38 // for Chrome on iOS with the applicable PrefStores. The |pref_filename| points
39 // to the user preference file. This is the usual way to create a new
40 // PrefService. |policy_service| is used as the source for mandatory or
41 // recommended policies. |pref_registry| keeps the list of registered prefs and
42 // their default valuers. If |async| is true, asynchronous version is used.
43 scoped_ptr
<PrefService
> CreateLocalState(
44 const base::FilePath
& pref_filename
,
45 base::SequencedTaskRunner
* pref_io_task_runner
,
46 policy::PolicyService
* policy_service
,
47 const scoped_refptr
<PrefRegistry
>& pref_registry
,
50 scoped_ptr
<syncable_prefs::PrefServiceSyncable
> CreateBrowserStatePrefs(
51 const base::FilePath
& browser_state_path
,
52 base::SequencedTaskRunner
* pref_io_task_runner
,
53 TrackedPreferenceValidationDelegate
* validation_delegate
,
54 policy::PolicyService
* policy_service
,
55 const scoped_refptr
<user_prefs::PrefRegistrySyncable
>& pref_registry
,
58 // Creates an incognito copy of |pref_service| that shares most prefs but uses
59 // a fresh non-persistent overlay for the user pref store.
60 scoped_ptr
<syncable_prefs::PrefServiceSyncable
>
61 CreateIncognitoBrowserStatePrefs(
62 syncable_prefs::PrefServiceSyncable
* main_pref_store
);
64 #endif // IOS_CHROME_BROWSER_PREFS_IOS_CHROME_PREF_SERVICE_FACTORY_H_