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

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

Issue 12189018: <webview>: Implement WebRequest API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Profile* => void* Created 7 years, 7 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 chrome = requireNative('chrome').GetChrome(); 10 var chrome = requireNative('chrome').GetChrome();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 get: function() { 122 get: function() {
123 return objectNode[attributeName]; 123 return objectNode[attributeName];
124 }, 124 },
125 set: function(value) { 125 set: function(value) {
126 objectNode[attributeName] = value; 126 objectNode[attributeName] = value;
127 }, 127 },
128 enumerable: true 128 enumerable: true
129 }); 129 });
130 }, this); 130 }, this);
131 131
132
132 // We cannot use {writable: true} property descriptor because we want dynamic 133 // We cannot use {writable: true} property descriptor because we want dynamic
133 // getter value. 134 // getter value.
134 Object.defineProperty(this.node_, 'contentWindow', { 135 Object.defineProperty(this.node_, 'contentWindow', {
135 get: function() { 136 get: function() {
136 // TODO(fsamuel): This is a workaround to enable 137 // TODO(fsamuel): This is a workaround to enable
137 // contentWindow.postMessage until http://crbug.com/152006 is fixed. 138 // contentWindow.postMessage until http://crbug.com/152006 is fixed.
138 if (objectNode.contentWindow) 139 if (objectNode.contentWindow)
139 return objectNode.contentWindow.self; 140 return objectNode.contentWindow.self;
140 console.error('contentWindow is not available at this time. ' + 141 console.error('contentWindow is not available at this time. ' +
141 'It will become available when the page has finished loading.'); 142 'It will become available when the page has finished loading.');
142 }, 143 },
143 // No setter. 144 // No setter.
144 enumerable: true 145 enumerable: true
145 }); 146 });
146 147
147 for (var eventName in WEB_VIEW_EVENTS) { 148 for (var eventName in WEB_VIEW_EVENTS) {
148 this.setupEvent_(eventName, WEB_VIEW_EVENTS[eventName]); 149 this.setupEvent_(eventName, WEB_VIEW_EVENTS[eventName]);
149 } 150 }
150 this.maybeSetupNewWindowEvent_(); 151 this.maybeSetupNewWindowEvent_();
151 this.maybeSetupPermissionEvent_(); 152 this.maybeSetupPermissionEvent_();
152 this.maybeSetupExecuteCodeAPI_(); 153 this.maybeSetupExecuteCodeAPI_();
154 this.maybeSetupWebRequestEvents_();
153 } 155 }
154 156
155 /** 157 /**
156 * @private 158 * @private
157 */ 159 */
158 WebView.prototype.handleMutation_ = function(mutation) { 160 WebView.prototype.handleMutation_ = function(mutation) {
159 // This observer monitors mutations to attributes of the <webview> and 161 // This observer monitors mutations to attributes of the <webview> and
160 // updates the BrowserPlugin properties accordingly. In turn, updating 162 // updates the BrowserPlugin properties accordingly. In turn, updating
161 // a BrowserPlugin property will update the corresponding BrowserPlugin 163 // a BrowserPlugin property will update the corresponding BrowserPlugin
162 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more 164 // attribute, if necessary. See BrowserPlugin::UpdateDOMAttribute for more
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 * @private 219 * @private
218 */ 220 */
219 WebView.prototype.maybeSetupPermissionEvent_ = function() {}; 221 WebView.prototype.maybeSetupPermissionEvent_ = function() {};
220 222
221 /** 223 /**
222 * Implemented when experimental permission is available. 224 * Implemented when experimental permission is available.
223 * @private 225 * @private
224 */ 226 */
225 WebView.prototype.maybeSetupExecuteScript_ = function() {}; 227 WebView.prototype.maybeSetupExecuteScript_ = function() {};
226 228
229 /**
230 * Implemented when experimental permission is available.
231 * @private
232 */
233 WebView.prototype.maybeSetupWebRequestEvents_ = function() {};
234
227 exports.WebView = WebView; 235 exports.WebView = WebView;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698