Index: chrome/browser/extensions/api/declarative_content/content_action.cc |
diff --git a/chrome/browser/extensions/api/declarative_content/content_action.cc b/chrome/browser/extensions/api/declarative_content/content_action.cc |
index 751f8d53383c946c633b1ef23066a414675e8554..3926a8b454da15235a59fa66abce6e8be658188a 100644 |
--- a/chrome/browser/extensions/api/declarative_content/content_action.cc |
+++ b/chrome/browser/extensions/api/declarative_content/content_action.cc |
@@ -94,6 +94,43 @@ class ShowPageAction : public ContentAction { |
DISALLOW_COPY_AND_ASSIGN(ShowPageAction); |
}; |
+// Action that injects a content script. |
+class RequestContentScript : public ContentAction { |
+ public: |
+ RequestContentScript() {} |
+ |
+ static scoped_refptr<ContentAction> Create(const Extension* extension, |
+ const base::DictionaryValue* dict, |
+ std::string* error, |
+ bool* bad_message) { |
+ return scoped_refptr<ContentAction>(new RequestContentScript); |
+ } |
+ |
+ // Implementation of ContentAction: |
+ virtual Type GetType() const OVERRIDE { |
+ return ACTION_REQUEST_CONTENT_SCRIPT; |
+ } |
+ |
+ virtual void Apply(const std::string& extension_id, |
+ const base::Time& extension_install_time, |
+ ApplyInfo* apply_info) const OVERRIDE { |
+ // TODO(markdittmer): Invoke UserScriptMaster declarative script loader: |
+ // load new user script. |
+ } |
+ |
+ virtual void Revert(const std::string& extension_id, |
+ const base::Time& extension_install_time, |
+ ApplyInfo* apply_info) const OVERRIDE { |
+ // TODO(markdittmer): Invoke UserScriptMaster declarative script loader: |
+ // unload user script. |
Jeffrey Yasskin
2014/06/27 22:03:41
It's impossible to unload a user script. These act
Mark Dittmer
2014/06/30 11:50:35
Perhaps this comment should say "stop future loads
|
+ } |
+ |
+ private: |
+ virtual ~RequestContentScript() {} |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RequestContentScript); |
+}; |
+ |
struct ContentActionFactory { |
// Factory methods for ContentAction instances. |extension| is the extension |
// for which the action is being created. |dict| contains the json dictionary |
@@ -113,6 +150,8 @@ struct ContentActionFactory { |
ContentActionFactory() { |
factory_methods[keys::kShowPageAction] = |
&ShowPageAction::Create; |
+ factory_methods[keys::kRequestContentScript] = |
+ &RequestContentScript::Create; |
} |
}; |