Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / pref_registry / testing_pref_service_syncable.cc
blob22602936c69ce8a870778d12fa2d02ad032c1efa
1 // Copyright 2014 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 #include "components/pref_registry/testing_pref_service_syncable.h"
7 #include "base/bind.h"
8 #include "base/prefs/pref_notifier_impl.h"
9 #include "base/prefs/pref_value_store.h"
10 #include "components/pref_registry/pref_registry_syncable.h"
12 template <>
13 TestingPrefServiceBase<PrefService, user_prefs::PrefRegistrySyncable>::
14 TestingPrefServiceBase(TestingPrefStore* managed_prefs,
15 TestingPrefStore* user_prefs,
16 TestingPrefStore* recommended_prefs,
17 user_prefs::PrefRegistrySyncable* pref_registry,
18 PrefNotifierImpl* pref_notifier)
19 : PrefService(pref_notifier,
20 new PrefValueStore(managed_prefs,
21 NULL, // supervised_user_prefs
22 NULL, // extension_prefs
23 NULL, // command_line_prefs
24 user_prefs,
25 recommended_prefs,
26 pref_registry->defaults().get(),
27 pref_notifier),
28 user_prefs,
29 pref_registry,
30 base::Bind(&TestingPrefServiceBase<
31 PrefService,
32 user_prefs::PrefRegistrySyncable>::HandleReadError),
33 false),
34 managed_prefs_(managed_prefs),
35 user_prefs_(user_prefs),
36 recommended_prefs_(recommended_prefs) {}
38 namespace user_prefs {
40 TestingPrefServiceSyncable::TestingPrefServiceSyncable()
41 : TestingPrefServiceBase<PrefService, PrefRegistrySyncable>(
42 new TestingPrefStore(),
43 new TestingPrefStore(),
44 new TestingPrefStore(),
45 new PrefRegistrySyncable(),
46 new PrefNotifierImpl()) {
49 TestingPrefServiceSyncable::TestingPrefServiceSyncable(
50 TestingPrefStore* managed_prefs,
51 TestingPrefStore* user_prefs,
52 TestingPrefStore* recommended_prefs,
53 PrefRegistrySyncable* pref_registry,
54 PrefNotifierImpl* pref_notifier)
55 : TestingPrefServiceBase<PrefService, PrefRegistrySyncable>(
56 managed_prefs,
57 user_prefs,
58 recommended_prefs,
59 pref_registry,
60 pref_notifier) {
63 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
66 PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
67 return static_cast<PrefRegistrySyncable*>(DeprecatedGetPrefRegistry());
70 } // namespace user_prefs