OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This module implements experimental API for <webview>. | 5 // This module implements experimental API for <webview>. |
6 // See web_view.js for details. | 6 // See web_view.js for details. |
7 // | 7 // |
8 // <webview> Experimental API is only available on canary and dev channels of | 8 // <webview> Chrome Experimental API is only available on canary and dev |
9 // Chrome. | 9 // channels of Chrome. |
10 | 10 |
11 var ContextMenusSchema = | 11 var ContextMenusSchema = |
12 requireNative('schema_registry').GetSchema('contextMenus'); | 12 requireNative('schema_registry').GetSchema('contextMenus'); |
13 var CreateEvent = require('webViewEvents').CreateEvent; | 13 var CreateEvent = require('webViewEvents').CreateEvent; |
14 var EventBindings = require('event_bindings'); | 14 var EventBindings = require('event_bindings'); |
15 var MessagingNatives = requireNative('messaging_natives'); | 15 var MessagingNatives = requireNative('messaging_natives'); |
16 //var WebView = require('webViewInternal').WebView; | 16 //var WebView = require('webViewInternal').WebView; |
17 var ChromeWebView = require('chromeWebViewInternal').ChromeWebView; | 17 var ChromeWebView = require('chromeWebViewInternal').ChromeWebView; |
18 var WebViewInternal = require('webView').WebViewInternal; | 18 var WebViewInternal = require('webView').WebViewInternal; |
19 var ChromeWebViewSchema = | 19 var ChromeWebViewSchema = |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (!defaultPrevented) { | 122 if (!defaultPrevented) { |
123 actionTaken = true; | 123 actionTaken = true; |
124 // The default action is equivalent to just showing the context menu as is. | 124 // The default action is equivalent to just showing the context menu as is. |
125 ChromeWebView.showContextMenu(this.guestInstanceId, requestId, undefined); | 125 ChromeWebView.showContextMenu(this.guestInstanceId, requestId, undefined); |
126 | 126 |
127 // TODO(lazyboy): Figure out a way to show warning message only when | 127 // TODO(lazyboy): Figure out a way to show warning message only when |
128 // listeners are registered for this event. | 128 // listeners are registered for this event. |
129 } // else we will ignore showing the context menu completely. | 129 } // else we will ignore showing the context menu completely. |
130 }; | 130 }; |
131 | 131 |
132 WebViewInternal.prototype.maybeGetExperimentalEvents = function() { | |
133 return {}; | |
134 }; | |
135 | |
136 /** @private */ | |
137 WebViewInternal.prototype.maybeGetExperimentalPermissions = function() { | |
138 return []; | |
139 }; | |
140 | |
141 /** @private */ | |
142 WebViewInternal.prototype.captureVisibleRegion = function(spec, callback) { | |
143 WebView.captureVisibleRegion(this.guestInstanceId, spec, callback); | |
144 }; | |
145 | |
146 WebViewInternal.maybeRegisterExperimentalAPIs = function(proto) { | |
147 proto.captureVisibleRegion = function(spec, callback) { | |
148 privates(this).internal.captureVisibleRegion(spec, callback); | |
149 }; | |
150 }; | |
151 | |
152 /** @private */ | 132 /** @private */ |
153 WebViewInternal.prototype.setupExperimentalContextMenus = function() { | 133 WebViewInternal.prototype.setupExperimentalContextMenus = function() { |
154 var createContextMenus = function() { | 134 var createContextMenus = function() { |
155 return function() { | 135 return function() { |
156 if (this.contextMenus_) { | 136 if (this.contextMenus_) { |
157 return this.contextMenus_; | 137 return this.contextMenus_; |
158 } | 138 } |
159 | 139 |
160 this.contextMenus_ = new WebViewContextMenus(this.viewInstanceId); | 140 this.contextMenus_ = new WebViewContextMenus(this.viewInstanceId); |
161 | 141 |
(...skipping 24 matching lines...) Expand all Loading... |
186 | 166 |
187 // Expose <webview>.contextMenus object. | 167 // Expose <webview>.contextMenus object. |
188 Object.defineProperty( | 168 Object.defineProperty( |
189 this.webviewNode, | 169 this.webviewNode, |
190 'contextMenus', | 170 'contextMenus', |
191 { | 171 { |
192 get: createContextMenus(), | 172 get: createContextMenus(), |
193 enumerable: true | 173 enumerable: true |
194 }); | 174 }); |
195 }; | 175 }; |
OLD | NEW |