Chromium Code Reviews| Index: extensions/renderer/resources/guest_view/web_view/web_view_api_methods.js |
| diff --git a/extensions/renderer/resources/guest_view/web_view/web_view_api_methods.js b/extensions/renderer/resources/guest_view/web_view/web_view_api_methods.js |
| index e42396e716b274ee11b02ef3c5adbe83513ae704..047436da0ff1c807f66e03e23f6f66ebdb38263e 100644 |
| --- a/extensions/renderer/resources/guest_view/web_view/web_view_api_methods.js |
| +++ b/extensions/renderer/resources/guest_view/web_view/web_view_api_methods.js |
| @@ -11,6 +11,9 @@ var WebViewImpl = require('webView').WebViewImpl; |
| // implementations will be given default implementations. Default |
| // implementations come from createDefaultApiMethod() in web_view.js. |
| var WEB_VIEW_API_METHODS = [ |
| + // Add content scripts for the guest page. |
| + 'addContentScripts', |
| + |
| // Navigates to the previous history entry. |
| 'back', |
| @@ -64,6 +67,9 @@ var WEB_VIEW_API_METHODS = [ |
| // Prints the contents of the webview. |
| 'print', |
| + // Removes content scripts for the guest page. |
| + 'removeContentScripts', |
| + |
| // Reloads the current top-level page. |
| 'reload', |
| @@ -89,6 +95,11 @@ var WEB_VIEW_API_METHODS = [ |
| // ----------------------------------------------------------------------------- |
| // Custom API method implementations. |
| +WebViewImpl.prototype.addContentScripts = function() { |
| + var args = $Array.concat([this.viewInstanceId], $Array.slice(arguments)); |
|
Devlin
2015/04/13 19:21:48
https://developer.mozilla.org/en-US/docs/Web/JavaS
Xi Han
2015/04/14 19:05:52
Not an expert here, just follow the ways other fun
|
| + return $Function.apply(WebViewInternal.addContentScripts, null, args); |
| +}; |
| + |
| WebViewImpl.prototype.back = function(callback) { |
| return this.go(-1, callback); |
| }; |
| @@ -148,6 +159,11 @@ WebViewImpl.prototype.print = function() { |
| return this.executeScript({code: 'window.print();'}); |
| }; |
| +WebViewImpl.prototype.removeContentScripts = function(var_args) { |
| + var args = $Array.concat([this.viewInstanceId], $Array.slice(arguments)); |
| + return $Function.apply(WebViewInternal.removeContentScripts, null, args); |
| +}; |
| + |
| WebViewImpl.prototype.setUserAgentOverride = function(userAgentOverride) { |
| this.userAgentOverride = userAgentOverride; |
| if (!this.guest.getId()) { |