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.
5 // This module implements chrome-specific <webview> API.
7 var ChromeWebView
= require('chromeWebViewInternal').ChromeWebView
;
8 var CreateEvent
= require('webViewEvents').CreateEvent
;
9 var EventBindings
= require('event_bindings');
10 var WebViewImpl
= require('webView').WebViewImpl
;
12 var CHROME_WEB_VIEW_EVENTS
= {
14 evt
: CreateEvent('chromeWebViewInternal.contextmenu'),
16 customHandler: function(handler
, event
, webViewEvent
) {
17 handler
.webViewImpl
.maybeHandleContextMenu(event
, webViewEvent
);
24 * Implemented when the ChromeWebView API is available.
27 WebViewImpl
.prototype.maybeGetChromeWebViewEvents = function() {
28 return CHROME_WEB_VIEW_EVENTS
;
32 * Calls to show contextmenu right away instead of dispatching a 'contextmenu'
34 * This will be overridden in chrome_web_view_experimental.js to implement
37 WebViewImpl
.prototype.maybeHandleContextMenu = function(e
, webViewEvent
) {
38 var requestId
= e
.requestId
;
39 // Setting |params| = undefined will show the context menu unmodified, hence
40 // the 'contextmenu' API is disabled for stable channel.
41 var params
= undefined;
42 ChromeWebView
.showContextMenu(this.guestInstanceId
, requestId
, params
);