Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This module implements helper objects for the dialog, newwindow, and | 5 // This module implements helper objects for the dialog, newwindow, and |
| 6 // permissionrequest <webview> events. | 6 // permissionrequest <webview> events. |
| 7 | 7 |
| 8 var MessagingNatives = requireNative('messaging_natives'); | 8 var MessagingNatives = requireNative('messaging_natives'); |
| 9 var WebViewConstants = require('webViewConstants').WebViewConstants; | 9 var WebViewConstants = require('webViewConstants').WebViewConstants; |
| 10 var WebViewInternal = require('webViewInternal').WebViewInternal; | 10 var WebViewInternal = require('webViewInternal').WebViewInternal; |
| 11 | 11 |
| 12 var PERMISSION_TYPES = ['media', | 12 var PERMISSION_TYPES = ['media', |
| 13 'geolocation', | 13 'geolocation', |
| 14 'pointerLock', | 14 'pointerLock', |
| 15 'download', | 15 'download', |
| 16 'loadplugin', | 16 'loadplugin', |
| 17 'filesystem']; | 17 'filesystem', |
| 18 'fullscreen']; | |
|
Fady Samuel
2015/03/13 01:43:06
super nit: Can we alphabetize this list?
| |
| 18 | 19 |
| 19 // ----------------------------------------------------------------------------- | 20 // ----------------------------------------------------------------------------- |
| 20 // WebViewActionRequest object. | 21 // WebViewActionRequest object. |
| 21 | 22 |
| 22 // Default partial implementation of a webview action request. | 23 // Default partial implementation of a webview action request. |
| 23 function WebViewActionRequest(webViewImpl, event, webViewEvent, interfaceName) { | 24 function WebViewActionRequest(webViewImpl, event, webViewEvent, interfaceName) { |
| 24 this.webViewImpl = webViewImpl; | 25 this.webViewImpl = webViewImpl; |
| 25 this.event = event; | 26 this.event = event; |
| 26 this.webViewEvent = webViewEvent; | 27 this.webViewEvent = webViewEvent; |
| 27 this.interfaceName = interfaceName; | 28 this.interfaceName = interfaceName; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 return true; | 244 return true; |
| 244 }; | 245 }; |
| 245 | 246 |
| 246 PermissionRequest.prototype.ERROR_MSG_ACTION_ALREADY_TAKEN = | 247 PermissionRequest.prototype.ERROR_MSG_ACTION_ALREADY_TAKEN = |
| 247 WebViewConstants.ERROR_MSG_PERMISSION_ACTION_ALREADY_TAKEN; | 248 WebViewConstants.ERROR_MSG_PERMISSION_ACTION_ALREADY_TAKEN; |
| 248 PermissionRequest.prototype.WARNING_MSG_REQUEST_BLOCKED = | 249 PermissionRequest.prototype.WARNING_MSG_REQUEST_BLOCKED = |
| 249 WebViewConstants.WARNING_MSG_PERMISSION_REQUEST_BLOCKED; | 250 WebViewConstants.WARNING_MSG_PERMISSION_REQUEST_BLOCKED; |
| 250 | 251 |
| 251 // ----------------------------------------------------------------------------- | 252 // ----------------------------------------------------------------------------- |
| 252 | 253 |
| 254 // FullscreenPermissionRequest object. | |
| 255 | |
| 256 // Represents a fullscreen permission request. | |
| 257 function FullscreenPermissionRequest(webViewImpl, event, webViewEvent) { | |
| 258 PermissionRequest.call(this, webViewImpl, event, webViewEvent); | |
| 259 } | |
| 260 | |
| 261 FullscreenPermissionRequest.prototype.__proto__ = PermissionRequest.prototype; | |
| 262 | |
| 263 FullscreenPermissionRequest.prototype.getInterfaceObject = function() { | |
| 264 return { | |
| 265 allow: function() { | |
| 266 this.validateCall(); | |
| 267 WebViewInternal.setPermission( | |
| 268 this.guestInstanceId, this.requestId, 'allow'); | |
| 269 // Now make the <webview> element go fullscreen. | |
| 270 this.webViewImpl.makeElementFullscreen(); | |
| 271 }.bind(this), | |
| 272 deny: function() { | |
| 273 this.validateCall(); | |
| 274 WebViewInternal.setPermission( | |
| 275 this.guestInstanceId, this.requestId, 'deny'); | |
| 276 }.bind(this) | |
| 277 }; | |
| 278 }; | |
| 279 | |
| 253 var WebViewActionRequests = { | 280 var WebViewActionRequests = { |
| 254 WebViewActionRequest: WebViewActionRequest, | 281 WebViewActionRequest: WebViewActionRequest, |
| 255 Dialog: Dialog, | 282 Dialog: Dialog, |
| 256 NewWindow: NewWindow, | 283 NewWindow: NewWindow, |
| 257 PermissionRequest: PermissionRequest | 284 PermissionRequest: PermissionRequest, |
| 285 FullscreenPermissionRequest: FullscreenPermissionRequest | |
| 258 }; | 286 }; |
| 259 | 287 |
| 260 exports.WebViewActionRequests = WebViewActionRequests; | 288 exports.WebViewActionRequests = WebViewActionRequests; |
| OLD | NEW |