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

Side by Side Diff: chrome/renderer/resources/extensions/web_view.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: Clean up the tests a bit. Created 7 years, 10 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 // Shim that simulates a <webview> tag via Mutation Observers. 5 // Shim that simulates a <webview> tag via Mutation Observers.
6 // 6 //
7 // The actual tag is implemented via the browser plugin. The internals of this 7 // The actual tag is implemented via the browser plugin. The internals of this
8 // are hidden via Shadow DOM. 8 // are hidden via Shadow DOM.
9 9
10 var watchForTag = require("tagWatcher").watchForTag; 10 var watchForTag = require("tagWatcher").watchForTag;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 console.error('contentWindow is not available at this time. ' + 122 console.error('contentWindow is not available at this time. ' +
123 'It will become available when the page has finished loading.'); 123 'It will become available when the page has finished loading.');
124 }, 124 },
125 // No setter. 125 // No setter.
126 enumerable: true 126 enumerable: true
127 }); 127 });
128 128
129 for (var eventName in WEB_VIEW_EVENTS) { 129 for (var eventName in WEB_VIEW_EVENTS) {
130 this.setupEvent_(eventName, WEB_VIEW_EVENTS[eventName]); 130 this.setupEvent_(eventName, WEB_VIEW_EVENTS[eventName]);
131 } 131 }
132 this.maybeSetupPermissionEvent_();
132 } 133 }
133 134
134 /** 135 /**
135 * @private 136 * @private
136 */ 137 */
137 WebView.prototype.handleMutation_ = function(mutation) { 138 WebView.prototype.handleMutation_ = function(mutation) {
138 // This observer monitors mutations to attributes of the <webview> and 139 // This observer monitors mutations to attributes of the <webview> and
139 // updates the BrowserPlugin properties accordingly. In turn, updating 140 // updates the BrowserPlugin properties accordingly. In turn, updating
140 // a BrowserPlugin property will update the corresponding BrowserPlugin 141 // a BrowserPlugin property will update the corresponding BrowserPlugin
141 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more 142 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
(...skipping 25 matching lines...) Expand all
167 WebView.prototype.setupEvent_ = function(eventname, attribs) { 168 WebView.prototype.setupEvent_ = function(eventname, attribs) {
168 var node = this.node_; 169 var node = this.node_;
169 this.objectNode_.addEventListener('-internal-' + eventname, function(e) { 170 this.objectNode_.addEventListener('-internal-' + eventname, function(e) {
170 var evt = new Event(eventname, { bubbles: true }); 171 var evt = new Event(eventname, { bubbles: true });
171 var detail = e.detail ? JSON.parse(e.detail) : {}; 172 var detail = e.detail ? JSON.parse(e.detail) : {};
172 attribs.forEach(function(attribName) { 173 attribs.forEach(function(attribName) {
173 evt[attribName] = detail[attribName]; 174 evt[attribName] = detail[attribName];
174 }); 175 });
175 node.dispatchEvent(evt); 176 node.dispatchEvent(evt);
176 }); 177 });
177 } 178 };
179
180 /**
181 * Implemented when experimental permission is available.
182 * @private
183 */
184 WebView.prototype.maybeSetupPermissionEvent_ = function() {};
185
186 exports.WebView = WebView;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698