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

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: Nit fix 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 ['reason'],
20 this.preparePremissionEvent_.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.preparePremissionEvent_ = function(webViewEvt, detail) {
29 if (detail.reason == 'media' && detail.request_id !== undefined) {
30 // TODO(lazyboy): Also fill in webViewEvt.url and webViewEvt.details (see
Fady Samuel 2012/12/05 22:14:32 Do it now?
lazyboy 2012/12/06 00:05:52 I'm not sure about the values, making the url gues
31 // webview specs).
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