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

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

Issue 3453029: Add user customizable launch type for apps. (Closed)
Patch Set: No images this time. Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.h
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index d753e08405857750dab72dd35c98adee78e312f1..01226cdb8987c31484e5d35c29fae765a539557b 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -21,8 +21,21 @@
// from there.
class ExtensionPrefs {
public:
+ // Key name for a preference that keeps track of per-extension settings. This
+ // is a dictionary object read from the Preferences file, keyed off of
+ // extension ids.
+ static const char kExtensionsPref[];
+
typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo;
+ // This enum is used for the launch type the user wants to use for an
+ // application.
+ enum LaunchType {
+ LAUNCH_PINNED,
+ LAUNCH_REGULAR,
+ LAUNCH_FULLSCREEN
+ };
+
explicit ExtensionPrefs(PrefService* prefs, const FilePath& root_dir_);
// Returns a copy of the Extensions prefs.
@@ -116,6 +129,9 @@ class ExtensionPrefs {
bool AllowFileAccess(const std::string& extension_id);
void SetAllowFileAccess(const std::string& extension_id, bool allow);
+ ExtensionPrefs::LaunchType GetLaunchType(const std::string& extension_id);
+ void SetLaunchType(const std::string& extension_id, LaunchType launch_type);
+
// Saves ExtensionInfo for each installed extension with the path to the
// version directory and the location. Blacklisted extensions won't be saved
// and neither will external extensions the user has explicitly uninstalled.
@@ -185,12 +201,30 @@ class ExtensionPrefs {
bool ReadExtensionPrefBoolean(const std::string& extension_id,
const std::string& pref_key);
+ // Reads an integer pref from |ext| with key |pref_key|.
+ // Return false if the value does not exist.
+ bool ReadIntegerFromPref(DictionaryValue* ext, const std::string& pref_key,
+ int* out_value);
+
+ // Reads an integer pref |pref_key| from extension with id |extension_id|.
+ bool ReadExtensionPrefInteger(const std::string& extension_id,
+ const std::string& pref_key,
+ int* out_value);
+
// Ensures and returns a mutable dictionary for extension |id|'s prefs.
DictionaryValue* GetOrCreateExtensionPref(const std::string& id);
// Same as above, but returns NULL if it doesn't exist.
DictionaryValue* GetExtensionPref(const std::string& id) const;
+ // Serializes the data and schedules a persistent save via the |PrefService|.
+ // Additionally fires a PREF_CHANGED notification with the top-level
+ // |kExtensionsPref| path set.
+ // TODO(andybons): Switch this to EXTENSION_PREF_CHANGED to be more granular.
+ // TODO(andybons): Use a ScopedPrefUpdate to update observers on changes to
+ // the mutable extension dictionary.
+ void SavePrefsAndNotify();
+
// Checks if kPrefBlacklist is set to true in the DictionaryValue.
// Return false if the value is false or kPrefBlacklist does not exist.
// This is used to decide if an extension is blacklisted.
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698