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

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

Issue 13037003: permissionrequest API for guest Download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync @tott Created 7 years, 8 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 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 WebView = require('webView').WebView; 14 var WebView = require('webView').WebView;
15 15
16 var forEach = require('utils').forEach; 16 var forEach = require('utils').forEach;
17 17
18 /** @type {Array.<string>} */ 18 /** @type {Array.<string>} */
19 var PERMISSION_TYPES = ['media', 'geolocation', 'pointerLock']; 19 var PERMISSION_TYPES = ['download', 'media', 'geolocation', 'pointerLock'];
20 20
21 /** @type {string} */ 21 /** @type {string} */
22 var REQUEST_TYPE_NEW_WINDOW = 'newwindow'; 22 var REQUEST_TYPE_NEW_WINDOW = 'newwindow';
23 23
24 /** @type {string} */ 24 /** @type {string} */
25 var ERROR_MSG_PERMISSION_ALREADY_DECIDED = '<webview>: ' + 25 var ERROR_MSG_PERMISSION_ALREADY_DECIDED = '<webview>: ' +
26 'Permission has already been decided for this "permissionrequest" event.'; 26 'Permission has already been decided for this "permissionrequest" event.';
27 27
28 var EXPOSED_PERMISSION_EVENT_ATTRIBS = [ 28 var EXPOSED_PERMISSION_EVENT_ATTRIBS = [
29 'lastUnlockedBySelf', 29 'lastUnlockedBySelf',
30 'permission', 30 'permission',
31 'requestMethod',
31 'url', 32 'url',
32 'userGesture' 33 'userGesture'
33 ]; 34 ];
34 35
35 /** @type {string} */ 36 /** @type {string} */
36 var ERROR_MSG_NEWWINDOW_ACTION_ALREADY_TAKEN = '<webview>: ' + 37 var ERROR_MSG_NEWWINDOW_ACTION_ALREADY_TAKEN = '<webview>: ' +
37 'An action has already been taken for this "newwindow" event.'; 38 'An action has already been taken for this "newwindow" event.';
38 39
39 /** @type {string} */ 40 /** @type {string} */
40 var ERROR_MSG_WEBVIEW_EXPECTED = '<webview> element expected.'; 41 var ERROR_MSG_WEBVIEW_EXPECTED = '<webview> element expected.';
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 window, detail.permission, requestId); 173 window, detail.permission, requestId);
173 174
174 var defaultPrevented = !node.dispatchEvent(evt); 175 var defaultPrevented = !node.dispatchEvent(evt);
175 if (!actionTaken && !defaultPrevented) { 176 if (!actionTaken && !defaultPrevented) {
176 actionTaken = true; 177 actionTaken = true;
177 // The default action is to discard the window. 178 // The default action is to discard the window.
178 objectNode['-internal-setPermission'](requestId, false); 179 objectNode['-internal-setPermission'](requestId, false);
179 } 180 }
180 }); 181 });
181 }; 182 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698