Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/test/testing_pref_service.h

Issue 3067017: Merge 53457 - Disable proxy config button and show banner if proxy prefs are managed. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/testing_pref_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef CHROME_TEST_TESTING_PREF_SERVICE_H_
6 #define CHROME_TEST_TESTING_PREF_SERVICE_H_
7 #pragma once
8
9 #include <chrome/browser/pref_service.h>
10
11 // A PrefService subclass for testing. It operates totally in memory and
12 // provides additional API for manipulating preferences at the different levels
13 // (managed, extension, user) conveniently.
14 class TestingPrefService : public PrefService {
15 public:
16 // Create an empty instance.
17 TestingPrefService();
18
19 // Read the value of a preference from the managed layer. Returns NULL if the
20 // preference is not defined at the managed layer.
21 const Value* GetManagedPref(const wchar_t* path);
22
23 // Set a preference on the managed layer and fire observers if the preference
24 // changed. Assumes ownership of |value|.
25 void SetManagedPref(const wchar_t* path, Value* value);
26
27 // Clear the preference on the managed layer and fire observers if the
28 // preference has been defined previously.
29 void RemoveManagedPref(const wchar_t* path);
30
31 // Similar to the above, but for user preferences.
32 const Value* GetUserPref(const wchar_t* path);
33 void SetUserPref(const wchar_t* path, Value* value);
34 void RemoveUserPref(const wchar_t* path);
35
36 private:
37 // Reads the value of the preference indicated by |path| from |pref_store|.
38 // Returns NULL if the preference was not found.
39 const Value* GetPref(PrefStore* pref_store, const wchar_t* path);
40
41 // Sets the value for |path| in |pref_store|.
42 void SetPref(PrefStore* pref_store, const wchar_t* path, Value* value);
43
44 // Removes the preference identified by |path| from |pref_store|.
45 void RemovePref(PrefStore* pref_store, const wchar_t* path);
46
47 // Pointers to the pref stores our value store uses.
48 PrefStore* managed_prefs_;
49 PrefStore* user_prefs_;
50 };
51
52 #endif // CHROME_TEST_TESTING_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/testing_pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698