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

Unified Diff: chrome/common/extensions/extension.h

Issue 11446034: SupportsUserData and manifest handlers for Extension; use them for the Omnibox API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + manifestdata Created 8 years 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/common/extensions/api/omnibox/omnibox_handler.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.h
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 19011c18525154d9b5333c7bda0375795a117c7a..c46c1a8fa34cbcb8494e7c3e3656f4fcd6e2b9c5 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -65,11 +65,14 @@ typedef std::set<std::string> OAuth2Scopes;
class Extension : public base::RefCountedThreadSafe<Extension> {
public:
struct InstallWarning;
+ struct ManifestData;
typedef std::map<const std::string, GURL> URLOverrideMap;
typedef std::vector<std::string> ScriptingWhitelist;
typedef std::vector<linked_ptr<FileBrowserHandler> > FileBrowserHandlerList;
typedef std::vector<InstallWarning> InstallWarningVector;
+ typedef std::map<const std::string, linked_ptr<ManifestData> >
+ ManifestDataMap;
// What an extension was loaded from.
// NOTE: These values are stored as integers in the preferences and used
@@ -267,6 +270,13 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
std::string message;
};
+ // A base class for parsed manifest data that APIs want to store on
+ // the extension. Related to base::SupportsUserData, but with an immutable
+ // thread-safe interface to match Extension.
+ struct ManifestData {
+ virtual ~ManifestData() {}
+ };
+
enum InitFromValueFlags {
NO_FLAGS = 0,
@@ -656,6 +666,15 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// Clears the tab-specific permissions of |tab_id|.
void ClearTabSpecificPermissions(int tab_id) const;
+ // Get the manifest data associated with the key, or NULL if there is none.
+ // Can only be called after InitValue is finished.
+ ManifestData* GetManifestData(const std::string& key) const;
+
+ // Sets |data| to be associated with the key. Takes ownership of |data|.
+ // Can only be called before InitValue is finished. Not thread-safe;
+ // all SetManifestData calls should be on only one thread.
+ void SetManifestData(const std::string& key, ManifestData* data);
+
// Accessors:
const Requirements& requirements() const { return requirements_; }
@@ -687,13 +706,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
const ActionInfo* system_indicator_info() const {
return system_indicator_info_.get();
}
- bool is_verbose_install_message() const {
- return !omnibox_keyword().empty() ||
- browser_action_info() ||
- (page_action_info() &&
- (page_action_command() ||
- !page_action_info()->default_icon.empty()));
- }
const FileBrowserHandlerList* file_browser_handlers() const {
return file_browser_handlers_.get();
}
@@ -766,7 +778,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
const URLOverrideMap& GetChromeURLOverrides() const {
return chrome_url_overrides_;
}
- const std::string omnibox_keyword() const { return omnibox_keyword_; }
bool incognito_split_mode() const { return incognito_split_mode_; }
bool offline_enabled() const { return offline_enabled_; }
const std::vector<TtsVoice>& tts_voices() const { return tts_voices_; }
@@ -873,7 +884,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
static bool IsTrustedId(const std::string& id);
Extension(const FilePath& path, scoped_ptr<extensions::Manifest> manifest);
- ~Extension();
+ virtual ~Extension();
// Initialize the extension from a parsed manifest.
// TODO(aa): Rename to just Init()? There's no Value here anymore.
@@ -943,6 +954,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
bool LoadFileHandlers(string16* error);
bool LoadExtensionFeatures(APIPermissionSet* api_permissions,
string16* error);
+ bool LoadManifestHandlerFeatures(string16* error);
bool LoadDevToolsPage(string16* error);
bool LoadInputComponents(const APIPermissionSet& api_permissions,
string16* error);
@@ -959,7 +971,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
FileBrowserHandler* LoadFileBrowserHandler(
const base::DictionaryValue* file_browser_handlers, string16* error);
bool LoadChromeURLOverrides(string16* error);
- bool LoadOmnibox(string16* error);
bool LoadTextToSpeechVoices(string16* error);
bool LoadIncognitoMode(string16* error);
bool LoadContentSecurityPolicy(string16* error);
@@ -1198,6 +1209,12 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// The manifest from which this extension was created.
scoped_ptr<Manifest> manifest_;
+ // Stored parsed manifest data.
+ ManifestDataMap manifest_data_;
+
+ // Set to true at the end of InitValue when initialization is finished.
+ bool finished_parsing_manifest_;
+
// A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs
// which override the handling of those URLs. (see ExtensionOverrideUI).
URLOverrideMap chrome_url_overrides_;
@@ -1230,9 +1247,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// Should this app be shown in the browser New Tab Page.
bool display_in_new_tab_page_;
- // The Omnibox keyword for this extension, or empty if there is none.
- std::string omnibox_keyword_;
-
// List of text-to-speech voices that this extension provides, if any.
std::vector<TtsVoice> tts_voices_;
« no previous file with comments | « chrome/common/extensions/api/omnibox/omnibox_handler.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698