OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_ | 5 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_ |
6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_ | 6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Clear the preference on the managed layer and fire observers if the | 29 // Clear the preference on the managed layer and fire observers if the |
30 // preference has been defined previously. | 30 // preference has been defined previously. |
31 void RemoveManagedPref(const char* path); | 31 void RemoveManagedPref(const char* path); |
32 | 32 |
33 // Similar to the above, but for user preferences. | 33 // Similar to the above, but for user preferences. |
34 const Value* GetUserPref(const char* path) const; | 34 const Value* GetUserPref(const char* path) const; |
35 void SetUserPref(const char* path, Value* value); | 35 void SetUserPref(const char* path, Value* value); |
36 void RemoveUserPref(const char* path); | 36 void RemoveUserPref(const char* path); |
37 | 37 |
| 38 // Similar to the above, but for recommended policy preferences. |
| 39 const Value* GetRecommendedPref(const char* path) const; |
| 40 void SetRecommendedPref(const char* path, Value* value); |
| 41 void RemoveRecommendedPref(const char* path); |
| 42 |
38 protected: | 43 protected: |
39 TestingPrefServiceBase( | 44 TestingPrefServiceBase( |
40 TestingPrefStore* managed_platform_prefs, | 45 TestingPrefStore* managed_platform_prefs, |
41 TestingPrefStore* user_prefs); | 46 TestingPrefStore* user_prefs, |
| 47 TestingPrefStore* recommended_platform_prefs); |
42 | 48 |
43 private: | 49 private: |
44 // Reads the value of the preference indicated by |path| from |pref_store|. | 50 // Reads the value of the preference indicated by |path| from |pref_store|. |
45 // Returns NULL if the preference was not found. | 51 // Returns NULL if the preference was not found. |
46 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; | 52 const Value* GetPref(TestingPrefStore* pref_store, const char* path) const; |
47 | 53 |
48 // Sets the value for |path| in |pref_store|. | 54 // Sets the value for |path| in |pref_store|. |
49 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); | 55 void SetPref(TestingPrefStore* pref_store, const char* path, Value* value); |
50 | 56 |
51 // Removes the preference identified by |path| from |pref_store|. | 57 // Removes the preference identified by |path| from |pref_store|. |
52 void RemovePref(TestingPrefStore* pref_store, const char* path); | 58 void RemovePref(TestingPrefStore* pref_store, const char* path); |
53 | 59 |
54 // Pointers to the pref stores our value store uses. | 60 // Pointers to the pref stores our value store uses. |
55 scoped_refptr<TestingPrefStore> managed_platform_prefs_; | 61 scoped_refptr<TestingPrefStore> managed_platform_prefs_; |
56 scoped_refptr<TestingPrefStore> user_prefs_; | 62 scoped_refptr<TestingPrefStore> user_prefs_; |
| 63 scoped_refptr<TestingPrefStore> recommended_platform_prefs_; |
57 | 64 |
58 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); | 65 DISALLOW_COPY_AND_ASSIGN(TestingPrefServiceBase); |
59 }; | 66 }; |
60 | 67 |
61 // Class for simplified construction of TestPrefServiceBase objects. | 68 // Class for simplified construction of TestPrefServiceBase objects. |
62 class TestingPrefService : public TestingPrefServiceBase { | 69 class TestingPrefService : public TestingPrefServiceBase { |
63 public: | 70 public: |
64 TestingPrefService(); | 71 TestingPrefService(); |
65 virtual ~TestingPrefService(); | 72 virtual ~TestingPrefService(); |
66 | 73 |
67 private: | 74 private: |
68 DISALLOW_COPY_AND_ASSIGN(TestingPrefService); | 75 DISALLOW_COPY_AND_ASSIGN(TestingPrefService); |
69 }; | 76 }; |
70 | 77 |
71 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_ | 78 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_ |
OLD | NEW |