From b413515529d74bb55b8990d1050a9fbf146159fa Mon Sep 17 00:00:00 2001 From: "paulmeyer@chromium.org" Date: Fri, 24 Jan 2014 20:39:38 +0000 Subject: [PATCH] Added documentation to web_view.js/web_view_experimental.js regarding the webview events structure. BUG= Review URL: https://codereview.chromium.org/145813002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246958 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/resources/extensions/web_view.js | 14 ++++++++++++++ .../renderer/resources/extensions/web_view_experimental.js | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js index 3707a636bc57..a41768107952 100644 --- a/chrome/renderer/resources/extensions/web_view.js +++ b/chrome/renderer/resources/extensions/web_view.js @@ -49,6 +49,20 @@ var CreateEvent = function(name) { return new EventBindings.Event(name, undefined, eventOpts); }; +// WEB_VIEW_EVENTS is a map of stable DOM event names to their +// associated extension event descriptor objects. +// An event listener will be attached to the extension event |evt| specified in +// the descriptor. +// |fields| specifies the public-facing fields in the DOM event that are +// accessible to developers. +// |customHandler| allows a handler function to be called each time an extension +// event is caught by its event listener. The DOM event should be dispatched +// within this handler function. With no handler function, the DOM event +// will be dispatched by default each time the extension event is caught. +// |cancelable| (default: false) specifies whether the event's default +// behavior can be canceled. If the default action associated with the event +// is prevented, then its dispatch function will return false in its event +// handler. The event must have a custom handler for this to be meaningful. var WEB_VIEW_EVENTS = { 'close': { evt: CreateEvent('webview.onClose'), diff --git a/chrome/renderer/resources/extensions/web_view_experimental.js b/chrome/renderer/resources/extensions/web_view_experimental.js index cd4194bf2cee..c38b863c94d7 100644 --- a/chrome/renderer/resources/extensions/web_view_experimental.js +++ b/chrome/renderer/resources/extensions/web_view_experimental.js @@ -16,6 +16,20 @@ var MessagingNatives = requireNative('messaging_natives'); var WebViewInternal = require('webView').WebViewInternal; var WebView = require('webView').WebView; +// WEB_VIEW_EXPERIMENTAL_EVENTS is a map of experimental DOM event +// names to their associated extension event descriptor objects. +// An event listener will be attached to the extension event |evt| specified in +// the descriptor. +// |fields| specifies the public-facing fields in the DOM event that are +// accessible to developers. +// |customHandler| allows a handler function to be called each time an extension +// event is caught by its event listener. The DOM event should be dispatched +// within this handler function. With no handler function, the DOM event +// will be dispatched by default each time the extension event is caught. +// |cancelable| (default: false) specifies whether the event's default +// behavior can be canceled. If the default action associated with the event +// is prevented, then its dispatch function will return false in its event +// handler. The event must have a custom handler for this to be meaningful. var WEB_VIEW_EXPERIMENTAL_EVENTS = { 'dialog': { cancelable: true, -- 2.11.4.GIT