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

Side by Side Diff: chrome/renderer/resources/extensions/web_view_permission_api.js

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle multiple listeners based on our discussion, requires 2 webkit changes. Created 8 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 // Shim extension to provide permission request API for <webview> tag.
6 // See web_view.js for details.
7 //
8 // We want to control the permission API feature in <webview> separately from
9 // the <webview> feature itself. <webview> will be migrated to 'stable' channel
10 // but we want keep permission API in <webview> only available in 'dev' channel.
11
12 var WebView = require('webview').WebView;
13
14 /**
15 * @private
16 */
17 WebView.prototype.maybeSetupPermissionEvent_ = function() {
18 this.setupEvent_('permissionrequest',
19 ['permission', 'url'],
20 this.preparePermissionEvent_.bind(this));
21 };
22
23 /**
24 * @param {Event} webViewEvt The event to be dispatched to <webview>.
25 * @param {!Object} detail The event details, originated from <object>.
26 * @private
27 */
28 WebView.prototype.preparePermissionEvent_ = function(webViewEvt, detail) {
29 if (detail.permission == 'media' && detail.request_id !== undefined) {
30 // TODO(lazyboy): Also fill in webViewEvt.details (see webview specs).
31 // http://crbug.com/141197.
32 var objectNode = this.objectNode_;
33 var requestId = detail.request_id;
34 webViewEvt.allow = function() {
35 objectNode.setMediaPermission(requestId, true);
36 };
37 webViewEvt.deny = function() {
38 objectNode.setMediaPermission(requestId, false);
39 };
40 }
41 };
42
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698