Home | History | Annotate | Download | only in pref_registry
      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.
      4 
      5 #include "components/pref_registry/testing_pref_service_syncable.h"
      6 
      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"
     11 
     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) {}
     37 
     38 namespace user_prefs {
     39 
     40 TestingPrefServiceSyncable::TestingPrefServiceSyncable()
     41     : TestingPrefServiceBase<PrefService, PrefRegistrySyncable>(
     42           new TestingPrefStore(),
     43           new TestingPrefStore(),
     44           new TestingPrefStore(),
     45           new PrefRegistrySyncable(),
     46           new PrefNotifierImpl()) {
     47 }
     48 
     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) {
     61 }
     62 
     63 TestingPrefServiceSyncable::~TestingPrefServiceSyncable() {
     64 }
     65 
     66 PrefRegistrySyncable* TestingPrefServiceSyncable::registry() {
     67   return static_cast<PrefRegistrySyncable*>(DeprecatedGetPrefRegistry());
     68 }
     69 
     70 }  // namespace user_prefs
     71