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

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: Implement first allow/deny wins, still requires preventDefault impl + now tests pass. 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 15 matching lines...) Expand all
157 } else { 158 } else {
158 // Update the <webview> attribute to match the BrowserPlugin attribute. 159 // Update the <webview> attribute to match the BrowserPlugin attribute.
159 this.node_.setAttribute(mutation.attributeName, 160 this.node_.setAttribute(mutation.attributeName,
160 this.objectNode_.getAttribute(mutation.attributeName)); 161 this.objectNode_.getAttribute(mutation.attributeName));
161 } 162 }
162 }; 163 };
163 164
164 /** 165 /**
165 * @private 166 * @private
166 */ 167 */
167 WebView.prototype.setupEvent_ = function(eventname, attribs) { 168 WebView.prototype.setupEvent_ = function(eventname, attribs, opt_prepareEvent) {
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 });
176 if (opt_prepareEvent) {
177 opt_prepareEvent(evt, detail);
178 }
175 node.dispatchEvent(evt); 179 node.dispatchEvent(evt);
Fady Samuel 2013/02/05 17:53:27 If true then we can deny... because preventDefault
lazyboy 2013/02/07 04:38:42 Updated CL.
176 }); 180 });
177 } 181 };
182
183 /**
184 * Implemented when experimental permission is available.
185 * @private
186 */
187 WebView.prototype.maybeSetupPermissionEvent_ = function() {};
188
189 exports.WebView = WebView;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698