| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 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 "chrome/test/testing_pref_service.h" |
| 6 |
| 7 #include "chrome/browser/dummy_pref_store.h" |
| 8 #include "chrome/browser/pref_value_store.h" |
| 9 |
| 10 TestingPrefService::TestingPrefService() |
| 11 : PrefService(new PrefValueStore( |
| 12 managed_prefs_ = new DummyPrefStore(), |
| 13 NULL, |
| 14 NULL, |
| 15 user_prefs_ = new DummyPrefStore(), |
| 16 NULL)) { |
| 17 } |
| 18 |
| 19 const Value* TestingPrefService::GetManagedPref(const wchar_t* path) { |
| 20 return GetPref(managed_prefs_, path); |
| 21 } |
| 22 |
| 23 void TestingPrefService::SetManagedPref(const wchar_t* path, Value* value) { |
| 24 SetPref(managed_prefs_, path, value); |
| 25 } |
| 26 |
| 27 void TestingPrefService::RemoveManagedPref(const wchar_t* path) { |
| 28 RemovePref(managed_prefs_, path); |
| 29 } |
| 30 |
| 31 const Value* TestingPrefService::GetUserPref(const wchar_t* path) { |
| 32 return GetPref(user_prefs_, path); |
| 33 } |
| 34 |
| 35 void TestingPrefService::SetUserPref(const wchar_t* path, Value* value) { |
| 36 SetPref(user_prefs_, path, value); |
| 37 } |
| 38 |
| 39 void TestingPrefService::RemoveUserPref(const wchar_t* path) { |
| 40 RemovePref(user_prefs_, path); |
| 41 } |
| 42 |
| 43 const Value* TestingPrefService::GetPref(PrefStore* pref_store, |
| 44 const wchar_t* path) { |
| 45 Value* result; |
| 46 return pref_store->prefs()->Get(path, &result) ? result : NULL; |
| 47 } |
| 48 |
| 49 void TestingPrefService::SetPref(PrefStore* pref_store, |
| 50 const wchar_t* path, |
| 51 Value* value) { |
| 52 pref_store->prefs()->Set(path, value); |
| 53 FireObservers(path); |
| 54 } |
| 55 |
| 56 void TestingPrefService::RemovePref(PrefStore* pref_store, |
| 57 const wchar_t* path) { |
| 58 pref_store->prefs()->Remove(path, NULL); |
| 59 FireObservers(path); |
| 60 } |
| OLD | NEW |