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

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

Issue 610643003: Adds new webview.loadDataWithBaseUrl API to allow data URLs to be loaded with a specified base URL … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. Created 6 years, 3 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
« no previous file with comments | « extensions/common/api/web_view_internal.json ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/web_view_experimental.js
diff --git a/extensions/renderer/resources/web_view_experimental.js b/extensions/renderer/resources/web_view_experimental.js
index c1246aecddaea2ff257f27d3655b00d60b7ea734..17bf2b23f86c1d3c3a407ac2d11b9d57b0b05173 100644
--- a/extensions/renderer/resources/web_view_experimental.js
+++ b/extensions/renderer/resources/web_view_experimental.js
@@ -9,6 +9,7 @@
// Chrome.
var WebViewInternal = require('webView').WebViewInternal;
+var WebView = require('webViewInternal').WebView;
WebViewInternal.prototype.maybeGetExperimentalEvents = function() {
return {};
@@ -24,8 +25,29 @@ WebViewInternal.prototype.captureVisibleRegion = function(spec, callback) {
WebView.captureVisibleRegion(this.guestInstanceId, spec, callback);
};
+/** @private */
+WebViewInternal.prototype.loadDataWithBaseUrl = function(
+ dataUrl, baseUrl, virtualUrl) {
+ if (!this.guestInstanceId) {
+ return;
+ }
+ WebView.loadDataWithBaseUrl(
+ this.guestInstanceId, dataUrl, baseUrl, virtualUrl, function () {
+ // Report any errors.
+ if (chrome.runtime.lastError != undefined) {
+ window.console.error(
+ "Error while running webview.loadDataWithBaseUrl: " +
+ chrome.runtime.lastError.message);
+ }
+ });
+};
+
WebViewInternal.maybeRegisterExperimentalAPIs = function(proto) {
proto.captureVisibleRegion = function(spec, callback) {
privates(this).internal.captureVisibleRegion(spec, callback);
};
+
+ proto.loadDataWithBaseUrl = function(dataUrl, baseUrl, virtualUrl) {
+ privates(this).internal.loadDataWithBaseUrl(dataUrl, baseUrl, virtualUrl);
+ }
};
« no previous file with comments | « extensions/common/api/web_view_internal.json ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698