Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / extensions / browser / extension_scoped_prefs.h
blob15fc577f2d0c600f577c703b11c494e3d3a04553
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.
5 #ifndef EXTENSIONS_BROWSER_EXTENSION_SCOPED_PREFS_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_SCOPED_PREFS_H_
8 namespace extensions {
10 class ExtensionScopedPrefs {
11 public:
12 ExtensionScopedPrefs() {}
13 ~ExtensionScopedPrefs() {}
15 // Sets the pref |key| for extension |id| to |value|.
16 virtual void UpdateExtensionPref(const std::string& id,
17 const std::string& key,
18 base::Value* value) = 0;
20 // Deletes the pref dictionary for extension |id|.
21 virtual void DeleteExtensionPrefs(const std::string& id) = 0;
23 // Reads a boolean pref |pref_key| from extension with id |extension_id|.
24 virtual bool ReadPrefAsBoolean(const std::string& extension_id,
25 const std::string& pref_key,
26 bool* out_value) const = 0;
28 // Reads an integer pref |pref_key| from extension with id |extension_id|.
29 virtual bool ReadPrefAsInteger(const std::string& extension_id,
30 const std::string& pref_key,
31 int* out_value) const = 0;
33 // Reads a string pref |pref_key| from extension with id |extension_id|.
34 virtual bool ReadPrefAsString(const std::string& extension_id,
35 const std::string& pref_key,
36 std::string* out_value) const = 0;
38 // Reads a list pref |pref_key| from extension with id |extension_id|.
39 virtual bool ReadPrefAsList(const std::string& extension_id,
40 const std::string& pref_key,
41 const base::ListValue** out_value) const = 0;
43 // Reads a dictionary pref |pref_key| from extension with id |extension_id|.
44 virtual bool ReadPrefAsDictionary(
45 const std::string& extension_id,
46 const std::string& pref_key,
47 const base::DictionaryValue** out_value) const = 0;
49 // Returns true if the prefs contain an entry for an extension with id
50 // |extension_id|.
51 virtual bool HasPrefForExtension(const std::string& extension_id) const = 0;
54 } // namespace extensions
56 #endif // EXTENSIONS_BROWSER_EXTENSION_SCOPED_PREFS_H_