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

Side by Side Diff: extensions/renderer/resources/web_view_experimental.js

Issue 654043002: Created "guest_view/" directory to contain all the guestview files (like web_view* and app_view*) i… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This module implements experimental API for <webview>.
6 // See web_view.js for details.
7 //
8 // <webview> Experimental API is only available on canary and dev channels of
9 // Chrome.
10
11 var WebViewInternal = require('webView').WebViewInternal;
12 var WebView = require('webViewInternal').WebView;
13
14 // Returns a map of experimental <webview> DOM event names to their associated
15 // extension event descriptor objects. See |WEB_VIEW_EVENTS| in
16 // web_view_events.js for more information and details on how this map should
17 // be formatted.
18 WebViewInternal.prototype.maybeGetExperimentalEvents = function() {
19 return {};
20 };
21
22 // Captures the visible content within the webview.
23 WebViewInternal.prototype.captureVisibleRegion = function(spec, callback) {
24 WebView.captureVisibleRegion(this.guestInstanceId, spec, callback);
25 };
26
27 // Loads a data URL with a specified base URL used for relative links.
28 // Optionally, a virtual URL can be provided to be shown to the user instead
29 // of the data URL.
30 WebViewInternal.prototype.loadDataWithBaseUrl = function(
31 dataUrl, baseUrl, virtualUrl) {
32 if (!this.guestInstanceId) {
33 return;
34 }
35 WebView.loadDataWithBaseUrl(
36 this.guestInstanceId, dataUrl, baseUrl, virtualUrl, function() {
37 // Report any errors.
38 if (chrome.runtime.lastError != undefined) {
39 window.console.error(
40 'Error while running webview.loadDataWithBaseUrl: ' +
41 chrome.runtime.lastError.message);
42 }
43 });
44 };
45
46 // Registers the experimantal WebVIew API when available.
47 WebViewInternal.maybeGetExperimentalAPIs = function() {
48 var experimentalMethods = [
49 'captureVisibleRegion',
50 'loadDataWithBaseUrl'
51 ];
52 return experimentalMethods;
53 };
OLDNEW
« no previous file with comments | « extensions/renderer/resources/web_view_events.js ('k') | extensions/renderer/resources/web_view_internal.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698