- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / extension_scoped_prefs.h
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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SCOPED_PREFS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SCOPED_PREFS_H_
7
8 class ExtensionScopedPrefs {
9  public:
10   ExtensionScopedPrefs() {}
11   ~ExtensionScopedPrefs() {}
12
13   // Sets the pref |key| for extension |id| to |value|.
14   virtual void UpdateExtensionPref(const std::string& id,
15                                    const std::string& key,
16                                    base::Value* value) = 0;
17
18   // Deletes the pref dictionary for extension |id|.
19   virtual void DeleteExtensionPrefs(const std::string& id) = 0;
20
21   // Reads a boolean pref |pref_key| from extension with id |extension_id|.
22   virtual bool ReadPrefAsBoolean(const std::string& extension_id,
23                                  const std::string& pref_key,
24                                  bool* out_value) const = 0;
25
26   // Reads an integer pref |pref_key| from extension with id |extension_id|.
27   virtual bool ReadPrefAsInteger(const std::string& extension_id,
28                                  const std::string& pref_key,
29                                  int* out_value) const = 0;
30
31   // Reads a string pref |pref_key| from extension with id |extension_id|.
32   virtual bool ReadPrefAsString(const std::string& extension_id,
33                                 const std::string& pref_key,
34                                 std::string* out_value) const = 0;
35
36   // Reads a list pref |pref_key| from extension with id |extension_id|.
37   virtual bool ReadPrefAsList(const std::string& extension_id,
38                               const std::string& pref_key,
39                               const base::ListValue** out_value) const = 0;
40
41   // Reads a dictionary pref |pref_key| from extension with id |extension_id|.
42   virtual bool ReadPrefAsDictionary(
43       const std::string& extension_id,
44       const std::string& pref_key,
45       const base::DictionaryValue** out_value) const = 0;
46
47   // Returns true if the prefs contain an entry for an extension with id
48   // |extension_id|.
49   virtual bool HasPrefForExtension(const std::string& extension_id) const = 0;
50 };
51
52 #endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_SCOPED_PREFS_H_