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

Unified Diff: chrome/browser/extensions/extension_prefs.h

Issue 4687005: Track permissions granted to extensions in prefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_prefs.h
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index eb16329357df7b3e80c46faf29897968ef076442..377bb1336c8a0627be7d4e1ebcfe8f6e231b25be 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -118,6 +118,18 @@ class ExtensionPrefs {
// the client's.
void SetLastPingDay(const std::string& extension_id, const base::Time& time);
+ // Gets the |api_permissions| and |host_permissions| granted to the extension
+ // with |extension_id|. Returns false if no permissions were granted yet.
+ bool GetGrantedPermissions(const std::string& extension_id,
+ std::set<std::string>* api_permissions,
+ std::set<std::string>* host_permissions);
+
+ // Grants the specified |api_permissions| and |host_permissions|
+ // to the extension with |extension_id|.
+ void GrantPermissions(const std::string& extension_id,
Aaron Boodman 2010/11/12 00:05:24 Nit: how about "SetLastGrantedPermissions" and "Ge
jstritar 2010/11/19 21:38:36 I didn't include "Last" in the name since these ho
Aaron Boodman 2010/11/22 07:57:53 Neat!
+ const std::set<std::string>& api_permissions,
+ const std::set<std::string>& host_permissions);
+
// Similar to the 2 above, but for the extensions blacklist.
base::Time BlacklistLastPingDay() const;
void SetBlacklistLastPingDay(const base::Time& time);
@@ -210,7 +222,7 @@ class ExtensionPrefs {
void DeleteExtensionPrefs(const std::string& id);
// Reads a boolean pref from |ext| with key |pref_key|.
- // Return false if the value is false or kPrefBlacklist does not exist.
+ // Return false if the value is false or |pref_key| does not exist.
bool ReadBooleanFromPref(DictionaryValue* ext, const std::string& pref_key);
// Reads a boolean pref |pref_key| from extension with id |extension_id|.
@@ -227,6 +239,23 @@ class ExtensionPrefs {
const std::string& pref_key,
int* out_value);
+ // Reads a list pref |pref_key| from extension with id | extension_id|.
+ bool ReadExtensionPrefList(const std::string& extension_id,
+ const std::string& pref_key,
+ ListValue** out_value);
+
+ // Reads a list pref |pref_key| as a string set from the extension with
+ // id |extension_id|.
+ bool ReadExtensionPrefStringSet(const std::string& extension_id,
+ const std::string& pref_key,
+ std::set<std::string>* result);
+
+ // Adds the |added_values| to the list preference at |pref_key| for the
+ // extension with id |extension_id|.
+ void AddToExtensionPrefStringSet(const std::string& extension_id,
+ const std::string& pref_key,
+ const std::set<std::string>& added_values);
+
// Ensures and returns a mutable dictionary for extension |id|'s prefs.
DictionaryValue* GetOrCreateExtensionPref(const std::string& id);

Powered by Google App Engine
This is Rietveld 408576698