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

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

Issue 20803004: Mark 'download' permissionrequest stable for <webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/renderer/resources/extensions/web_view.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // permission API would only be available for channels CHANNEL_DEV and 11 // permission API would only be available for channels CHANNEL_DEV and
12 // CHANNEL_CANARY. 12 // CHANNEL_CANARY.
13 13
14 var WebRequestEvent = require('webRequestInternal').WebRequestEvent; 14 var WebRequestEvent = require('webRequestInternal').WebRequestEvent;
15 var webRequestSchema = 15 var webRequestSchema =
16 requireNative('schema_registry').GetSchema('webRequest'); 16 requireNative('schema_registry').GetSchema('webRequest');
17 var WebView = require('webView').WebView; 17 var WebView = require('webView').WebView;
18 18
19 /** 19 /**
20 * @private 20 * @private
21 */ 21 */
22 WebView.prototype.maybeSetupExperimentalAPI_ = function() { 22 WebView.prototype.maybeSetupExperimentalAPI_ = function() {
23 this.setupWebRequestEvents_(); 23 this.setupWebRequestEvents_();
24 this.setupDialogEvent_(); 24 this.setupDialogEvent_();
25 }; 25 };
26 26
27 /** 27 /**
28 * @private 28 * @private
29 */ 29 */
30 WebView.prototype.maybeGetExperimentalPermissionTypes_ = function() {
31 var PERMISSION_TYPES = ['download'];
32 return PERMISSION_TYPES;
33 };
34
35 /**
36 * @private
37 */
38 WebView.prototype.setupWebRequestEvents_ = function() { 30 WebView.prototype.setupWebRequestEvents_ = function() {
39 var self = this; 31 var self = this;
40 // Populate the WebRequest events from the API definition. 32 // Populate the WebRequest events from the API definition.
41 for (var i = 0; i < webRequestSchema.events.length; ++i) { 33 for (var i = 0; i < webRequestSchema.events.length; ++i) {
42 Object.defineProperty(self.webviewNode_, 34 Object.defineProperty(self.webviewNode_,
43 webRequestSchema.events[i].name, { 35 webRequestSchema.events[i].name, {
44 get: function(webRequestEvent) { 36 get: function(webRequestEvent) {
45 return function() { 37 return function() {
46 if (!self[webRequestEvent.name + '_']) { 38 if (!self[webRequestEvent.name + '_']) {
47 self[webRequestEvent.name + '_'] = 39 self[webRequestEvent.name + '_'] =
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 onTrackedObjectGoneWithRequestId); 135 onTrackedObjectGoneWithRequestId);
144 browserPluginNode['-internal-trackObjectLifetime'](dialog, requestId); 136 browserPluginNode['-internal-trackObjectLifetime'](dialog, requestId);
145 } else { 137 } else {
146 actionTaken = true; 138 actionTaken = true;
147 // The default action is equivalent to canceling the dialog. 139 // The default action is equivalent to canceling the dialog.
148 browserPluginNode['-internal-setPermission'](requestId, false, ''); 140 browserPluginNode['-internal-setPermission'](requestId, false, '');
149 showWarningMessage(detail.messageType); 141 showWarningMessage(detail.messageType);
150 } 142 }
151 }); 143 });
152 }; 144 };
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/web_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698