| 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.
|
| + }
|
| +
|
| + 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;
|
| }
|
| };
|
|
|
|
|