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 the attributes of the <webview> tag. | 5 // This module implements the attributes of the <webview> tag. |
6 | 6 |
7 var GuestViewAttributes = require('guestViewAttributes').GuestViewAttributes; | 7 var GuestViewAttributes = require('guestViewAttributes').GuestViewAttributes; |
| 8 var WebViewConstants = require('webViewConstants').WebViewConstants; |
8 var WebViewImpl = require('webView').WebViewImpl; | 9 var WebViewImpl = require('webView').WebViewImpl; |
9 var WebViewConstants = require('webViewConstants').WebViewConstants; | |
10 var WebViewInternal = require('webViewInternal').WebViewInternal; | 10 var WebViewInternal = require('webViewInternal').WebViewInternal; |
11 | 11 |
12 // ----------------------------------------------------------------------------- | 12 // ----------------------------------------------------------------------------- |
13 // AllowScalingAttribute object. | 13 // AllowScalingAttribute object. |
14 | 14 |
15 // Attribute that specifies whether scaling is allowed in the webview. | 15 // Attribute that specifies whether scaling is allowed in the webview. |
16 function AllowScalingAttribute(view) { | 16 function AllowScalingAttribute(view) { |
17 GuestViewAttributes.BooleanAttribute.call( | 17 GuestViewAttributes.BooleanAttribute.call( |
18 this, WebViewConstants.ATTRIBUTE_ALLOWSCALING, view); | 18 this, WebViewConstants.ATTRIBUTE_ALLOWSCALING, view); |
19 } | 19 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 return; | 246 return; |
247 } | 247 } |
248 | 248 |
249 WebViewInternal.navigate(this.view.guest.getId(), this.getValue()); | 249 WebViewInternal.navigate(this.view.guest.getId(), this.getValue()); |
250 }; | 250 }; |
251 | 251 |
252 // ----------------------------------------------------------------------------- | 252 // ----------------------------------------------------------------------------- |
253 | 253 |
254 // Sets up all of the webview attributes. | 254 // Sets up all of the webview attributes. |
255 WebViewImpl.prototype.setupWebViewAttributes = function() { | 255 WebViewImpl.prototype.setupAttributes = function() { |
256 this.attributes = {}; | |
257 | |
258 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWSCALING] = | 256 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWSCALING] = |
259 new AllowScalingAttribute(this); | 257 new AllowScalingAttribute(this); |
260 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] = | 258 this.attributes[WebViewConstants.ATTRIBUTE_ALLOWTRANSPARENCY] = |
261 new AllowTransparencyAttribute(this); | 259 new AllowTransparencyAttribute(this); |
262 this.attributes[WebViewConstants.ATTRIBUTE_AUTOSIZE] = | 260 this.attributes[WebViewConstants.ATTRIBUTE_AUTOSIZE] = |
263 new AutosizeAttribute(this); | 261 new AutosizeAttribute(this); |
264 this.attributes[WebViewConstants.ATTRIBUTE_NAME] = | 262 this.attributes[WebViewConstants.ATTRIBUTE_NAME] = |
265 new NameAttribute(this); | 263 new NameAttribute(this); |
266 this.attributes[WebViewConstants.ATTRIBUTE_PARTITION] = | 264 this.attributes[WebViewConstants.ATTRIBUTE_PARTITION] = |
267 new PartitionAttribute(this); | 265 new PartitionAttribute(this); |
268 this.attributes[WebViewConstants.ATTRIBUTE_SRC] = | 266 this.attributes[WebViewConstants.ATTRIBUTE_SRC] = |
269 new SrcAttribute(this); | 267 new SrcAttribute(this); |
270 | 268 |
271 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, | 269 var autosizeAttributes = [WebViewConstants.ATTRIBUTE_MAXHEIGHT, |
272 WebViewConstants.ATTRIBUTE_MAXWIDTH, | 270 WebViewConstants.ATTRIBUTE_MAXWIDTH, |
273 WebViewConstants.ATTRIBUTE_MINHEIGHT, | 271 WebViewConstants.ATTRIBUTE_MINHEIGHT, |
274 WebViewConstants.ATTRIBUTE_MINWIDTH]; | 272 WebViewConstants.ATTRIBUTE_MINWIDTH]; |
275 for (var i = 0; autosizeAttributes[i]; ++i) { | 273 for (var i = 0; autosizeAttributes[i]; ++i) { |
276 this.attributes[autosizeAttributes[i]] = | 274 this.attributes[autosizeAttributes[i]] = |
277 new AutosizeDimensionAttribute(autosizeAttributes[i], this); | 275 new AutosizeDimensionAttribute(autosizeAttributes[i], this); |
278 } | 276 } |
279 }; | 277 }; |
OLD | NEW |