OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // Event management for WebView. | 5 // Event management for WebView. |
6 | 6 |
7 var CreateEvent = require('guestViewEvents').CreateEvent; | 7 var CreateEvent = require('guestViewEvents').CreateEvent; |
8 var DeclarativeWebRequestSchema = | 8 var DeclarativeWebRequestSchema = |
9 requireNative('schema_registry').GetSchema('declarativeWebRequest'); | 9 requireNative('schema_registry').GetSchema('declarativeWebRequest'); |
10 var EventBindings = require('event_bindings'); | 10 var EventBindings = require('event_bindings'); |
11 var GuestViewEvents = require('guestViewEvents').GuestViewEvents; | 11 var GuestViewEvents = require('guestViewEvents').GuestViewEvents; |
12 var IdGenerator = requireNative('id_generator'); | 12 var IdGenerator = requireNative('id_generator'); |
13 var WebRequestEvent = require('webRequestInternal').WebRequestEvent; | 13 var WebRequestEvent = require('webRequestInternal').WebRequestEvent; |
14 var WebRequestSchema = | 14 var WebRequestSchema = |
15 requireNative('schema_registry').GetSchema('webRequest'); | 15 requireNative('schema_registry').GetSchema('webRequest'); |
16 var WebViewActionRequests = | 16 var WebViewActionRequests = |
17 require('webViewActionRequests').WebViewActionRequests; | 17 require('webViewActionRequests').WebViewActionRequests; |
18 | 18 |
19 var WebRequestMessageEvent = CreateEvent('webViewInternal.onMessage'); | 19 var WebRequestMessageEvent = CreateEvent('webViewInternal.onMessage'); |
20 | 20 |
21 function WebViewEvents(webViewImpl) { | 21 function WebViewEvents(webViewImpl) { |
22 GuestViewEvents.call(this, webViewImpl); | 22 GuestViewEvents.call(this, webViewImpl); |
23 | 23 |
24 this.setupWebRequestEvents(); | 24 this.setupWebRequestEvents(); |
25 this.view.setupExperimentalContextMenus(); | 25 this.view.maybeSetupContextMenus(); |
26 } | 26 } |
27 | 27 |
28 WebViewEvents.prototype.__proto__ = GuestViewEvents.prototype; | 28 WebViewEvents.prototype.__proto__ = GuestViewEvents.prototype; |
29 | 29 |
30 // A dictionary of <webview> extension events to be listened for. This | 30 // A dictionary of <webview> extension events to be listened for. This |
31 // dictionary augments |GuestViewEvents.EVENTS| in guest_view_events.js. See the | 31 // dictionary augments |GuestViewEvents.EVENTS| in guest_view_events.js. See the |
32 // documentation there for details. | 32 // documentation there for details. |
33 WebViewEvents.EVENTS = { | 33 WebViewEvents.EVENTS = { |
34 'close': { | 34 'close': { |
35 evt: CreateEvent('webViewInternal.onClose') | 35 evt: CreateEvent('webViewInternal.onClose') |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 WebRequestMessageEvent.addListener(function() { | 272 WebRequestMessageEvent.addListener(function() { |
273 // Re-dispatch to subEvent's listeners. | 273 // Re-dispatch to subEvent's listeners. |
274 $Function.apply(this.dispatch, this, $Array.slice(arguments)); | 274 $Function.apply(this.dispatch, this, $Array.slice(arguments)); |
275 }.bind(this), {instanceId: opt_webViewInstanceId || 0}); | 275 }.bind(this), {instanceId: opt_webViewInstanceId || 0}); |
276 } | 276 } |
277 | 277 |
278 DeclarativeWebRequestEvent.prototype.__proto__ = EventBindings.Event.prototype; | 278 DeclarativeWebRequestEvent.prototype.__proto__ = EventBindings.Event.prototype; |
279 | 279 |
280 // Exports. | 280 // Exports. |
281 exports.WebViewEvents = WebViewEvents; | 281 exports.WebViewEvents = WebViewEvents; |
OLD | NEW |