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

Unified Diff: extensions/renderer/resources/guest_view/web_view_experimental.js

Issue 959413003: Implement <webview>.addContentScript/removeContentScript API [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Can compile and no crash on extensions. Created 5 years, 10 months 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
Index: extensions/renderer/resources/guest_view/web_view_experimental.js
diff --git a/extensions/renderer/resources/guest_view/web_view_experimental.js b/extensions/renderer/resources/guest_view/web_view_experimental.js
index 6214eda742e1c6dd25afa47b76fd5e998948978f..f8420c06256a6a0d6d75663a7b6ba5a03d391502 100644
--- a/extensions/renderer/resources/guest_view/web_view_experimental.js
+++ b/extensions/renderer/resources/guest_view/web_view_experimental.js
@@ -30,10 +30,30 @@ WebViewImpl.prototype.loadDataWithBaseUrl = function(
});
};
+WebViewImpl.prototype.addContentScripts = function() {
+ if (!this.guest.getId()) {
+ window.console.error(WebViewConstants.ERROR_MSG_CANNOT_INJECT_SCRIPT);
+ return false;
+ }
+ var args = $Array.concat([this.guest.getId()], $Array.slice(arguments));
+ return $Function.apply(WebViewInternal.addContentScripts, null, args);
+};
+
+WebViewImpl.prototype.removeContentScripts = function(var_args) {
+ if (!this.guest.getId()) {
+ window.console.error(WebViewConstants.ERROR_MSG_CANNOT_INJECT_SCRIPT);
+ return false;
+ }
+ var args = $Array.concat([this.guest.getId()], $Array.slice(arguments));
+ return $Function.apply(WebViewInternal.removeContentScripts, null, args);
+};
+
// An array of <webview>'s experimental API methods. See |WEB_VIEW_API_METHODS|
// in web_view_api_methods.js for more details.
var WEB_VIEW_EXPERIMENTAL_API_METHODS = [
- 'loadDataWithBaseUrl'
+ 'loadDataWithBaseUrl',
+ 'addContentScripts',
+ 'removeContentScripts'
];
// Registers the experimantal WebVIew API when available.

Powered by Google App Engine
This is Rietveld 408576698