summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorhanxi <hanxi@chromium.org>2015-04-27 07:09:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-27 14:09:59 +0000
commit0f31f97fc9577a559a527a3421981b75427791b8 (patch)
tree59eaad2de65376b07b01900df5d6abfed55ce279 /extensions
parent19ec19105cc04f12bfaf62c1f6a62058a8b010ec (diff)
downloadchromium_src-0f31f97fc9577a559a527a3421981b75427791b8.zip
chromium_src-0f31f97fc9577a559a527a3421981b75427791b8.tar.gz
chromium_src-0f31f97fc9577a559a527a3421981b75427791b8.tar.bz2
Implement <webview>.addContentScript/removeContentScript API [3]
This patch enables the code injection for <webview>.addContentScript/removeContentScript API. This is the third patch in a series of patches: 1) Implement <webview>.addContentScript/removeContentScript API [1] (https://codereview.chromium.org/959413003) 2) Implement <webview>.addContentScript/removeContentScript API [2] (https://codereview.chromium.org/1056533002) 3) Implement <webview>.addContentScript/removeContentScript API [3] (https://codereview.chromium.org/1058113002) BUG=461052 Review URL: https://codereview.chromium.org/1058113002 Cr-Commit-Position: refs/heads/master@{#327037}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/guest_view/web_view/web_view_internal_api.cc8
-rw-r--r--extensions/common/api/web_view_internal.json5
2 files changed, 13 insertions, 0 deletions
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
index af44753..0627e78 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -174,6 +174,14 @@ bool ParseContentScript(const ContentScriptDetails& script_value,
}
}
+ // code:
+ if (script_value.code) {
+ extensions::UserScript::File file((base::FilePath()), (base::FilePath()),
+ GURL());
+ file.set_content(*(script_value.code.get()));
+ script->js_scripts().push_back(file);
+ }
+
// all_frames:
if (script_value.all_frames)
script->set_match_all_frames(*(script_value.all_frames));
diff --git a/extensions/common/api/web_view_internal.json b/extensions/common/api/web_view_internal.json
index 1ecfba4..b6c425a 100644
--- a/extensions/common/api/web_view_internal.json
+++ b/extensions/common/api/web_view_internal.json
@@ -131,6 +131,11 @@
"optional": true,
"description": "The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array."
},
+ "code": {
+ "type": "string",
+ "optional": true,
+ "description": "JavaScript code to be injected into matching pages."
+ },
"run_at": {
"$ref": "extensionTypes.RunAt",
"optional": true,