OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 extension to provide permission request API (and possibly other future | 5 // Shim extension to provide permission request API (and possibly other future |
6 // experimental APIs) for <webview> tag. | 6 // experimental APIs) for <webview> tag. |
7 // See web_view.js for details. | 7 // See web_view.js for details. |
8 // | 8 // |
9 // We want to control the permission API feature in <webview> separately from | 9 // We want to control the permission API feature in <webview> separately from |
10 // the <webview> feature itself. <webview> is available in stable channel, but | 10 // the <webview> feature itself. <webview> is available in stable channel, but |
(...skipping 20 matching lines...) Expand all Loading... |
31 var self = this; | 31 var self = this; |
32 var request = {}; | 32 var request = {}; |
33 var createWebRequestEvent = function(webRequestEvent) { | 33 var createWebRequestEvent = function(webRequestEvent) { |
34 return function() { | 34 return function() { |
35 if (!self[webRequestEvent.name + '_']) { | 35 if (!self[webRequestEvent.name + '_']) { |
36 self[webRequestEvent.name + '_'] = | 36 self[webRequestEvent.name + '_'] = |
37 new WebRequestEvent( | 37 new WebRequestEvent( |
38 'webview.' + webRequestEvent.name, | 38 'webview.' + webRequestEvent.name, |
39 webRequestEvent.parameters, | 39 webRequestEvent.parameters, |
40 webRequestEvent.extraParameters, null, | 40 webRequestEvent.extraParameters, null, |
41 self.browserPluginNode_.getInstanceId()); | 41 self.viewInstanceId_); |
42 } | 42 } |
43 return self[webRequestEvent.name + '_']; | 43 return self[webRequestEvent.name + '_']; |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 // Populate the WebRequest events from the API definition. | 47 // Populate the WebRequest events from the API definition. |
48 for (var i = 0; i < webRequestSchema.events.length; ++i) { | 48 for (var i = 0; i < webRequestSchema.events.length; ++i) { |
49 var webRequestEvent = createWebRequestEvent(webRequestSchema.events[i]); | 49 var webRequestEvent = createWebRequestEvent(webRequestSchema.events[i]); |
50 Object.defineProperty( | 50 Object.defineProperty( |
51 request, | 51 request, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 onTrackedObjectGoneWithRequestId); | 161 onTrackedObjectGoneWithRequestId); |
162 browserPluginNode['-internal-trackObjectLifetime'](dialog, requestId); | 162 browserPluginNode['-internal-trackObjectLifetime'](dialog, requestId); |
163 } else { | 163 } else { |
164 actionTaken = true; | 164 actionTaken = true; |
165 // The default action is equivalent to canceling the dialog. | 165 // The default action is equivalent to canceling the dialog. |
166 browserPluginNode['-internal-setPermission'](requestId, false, ''); | 166 browserPluginNode['-internal-setPermission'](requestId, false, ''); |
167 showWarningMessage(detail.messageType); | 167 showWarningMessage(detail.messageType); |
168 } | 168 } |
169 }); | 169 }); |
170 }; | 170 }; |
OLD | NEW |