Chromium Code Reviews| 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..68cc38f99fa034236699e3bee9349e9a920c1478 100644 |
| --- a/chrome/browser/extensions/api/declarative_content/content_action.cc |
| +++ b/chrome/browser/extensions/api/declarative_content/content_action.cc |
| @@ -94,6 +94,41 @@ class ShowPageAction : public ContentAction { |
| DISALLOW_COPY_AND_ASSIGN(ShowPageAction); |
| }; |
| +// Action that injects a content script. |
| +class RequestContentScript : public ContentAction { |
|
Fady Samuel
2014/06/23 18:56:28
I feel like this should be called InjectContentScr
Mark Dittmer
2014/06/24 14:14:19
I agree, actually. What do you think kalman@?
|
| + 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; |
| + } |
|
Fady Samuel
2014/06/23 18:56:28
Add empty line after this.
Mark Dittmer
2014/06/24 14:14:19
Done.
|
| + 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. |
| + } |
|
Fady Samuel
2014/06/23 18:56:28
Add empty line after this.
Mark Dittmer
2014/06/24 14:14:19
Done.
|
| + 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 +148,8 @@ struct ContentActionFactory { |
| ContentActionFactory() { |
| factory_methods[keys::kShowPageAction] = |
| &ShowPageAction::Create; |
| + factory_methods[keys::kRequestContentScript] = |
| + &RequestContentScript::Create; |
| } |
| }; |