[content shell] implement testRunner.overridePreference
[chromium-blink-merge.git] / base / prefs / default_pref_store.h
blob996bf8b77df37aceadbb0d69a299aa313e99a9f9
1 // Copyright (c) 2012 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 #ifndef BASE_PREFS_DEFAULT_PREF_STORE_H_
6 #define BASE_PREFS_DEFAULT_PREF_STORE_H_
8 #include <string>
10 #include "base/prefs/base_prefs_export.h"
11 #include "base/prefs/pref_store.h"
12 #include "base/prefs/pref_value_map.h"
13 #include "base/values.h"
15 // This PrefStore keeps track of default preference values set when a
16 // preference is registered with the PrefService.
17 class BASE_PREFS_EXPORT DefaultPrefStore : public PrefStore {
18 public:
19 typedef PrefValueMap::const_iterator const_iterator;
21 DefaultPrefStore();
23 virtual bool GetValue(const std::string& key,
24 const base::Value** result) const OVERRIDE;
26 // Stores a new |value| for |key|. Assumes ownership of |value|.
27 void SetDefaultValue(const std::string& key, Value* value);
29 // Removes the value for |key|.
30 void RemoveDefaultValue(const std::string& key);
32 // Returns the registered type for |key| or Value::TYPE_NULL if the |key|
33 // has not been registered.
34 base::Value::Type GetType(const std::string& key) const;
36 const_iterator begin() const;
37 const_iterator end() const;
39 protected:
40 virtual ~DefaultPrefStore();
42 private:
43 PrefValueMap prefs_;
45 DISALLOW_COPY_AND_ASSIGN(DefaultPrefStore);
48 #endif // BASE_PREFS_DEFAULT_PREF_STORE_H_