OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class _HTMLIFrameElementJs extends _HTMLElementJs implements HTMLIFrameElement n
ative "*HTMLIFrameElement" { | 5 class _HTMLIFrameElementJs extends _HTMLElementJs implements HTMLIFrameElement n
ative "*HTMLIFrameElement" { |
6 | 6 |
7 String align; | 7 String align; |
8 | 8 |
9 String frameBorder; | 9 String frameBorder; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 _SVGDocumentJs getSVGDocument() native; | 29 _SVGDocumentJs getSVGDocument() native; |
30 | 30 |
31 | 31 |
32 Window get _contentWindow() native "return this.contentWindow;"; | 32 Window get _contentWindow() native "return this.contentWindow;"; |
33 | 33 |
34 // Override contentWindow to return secure wrapper. | 34 // Override contentWindow to return secure wrapper. |
35 Window get contentWindow() { | 35 Window get contentWindow() { |
36 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow); | 36 return _DOMWindowCrossFrameImpl._createSafe(_contentWindow); |
37 } | 37 } |
38 } | 38 } |
39 | |
40 // TODO(vsm): Unify with Dartium version. | |
41 class _DOMWindowCrossFrameImpl implements DOMType, DOMWindow { | |
42 // Private window. | |
43 _DOMWindowJs _window; | |
44 | |
45 // DOMType | |
46 var dartObjectLocalStorage; | |
47 String get typeName() => "DOMWindow"; | |
48 | |
49 // Fields. | |
50 // TODO(vsm): Wrap these two. | |
51 History get history() => _window.history; | |
52 Location get location() => _window.location; | |
53 | |
54 bool get closed() => _window.closed; | |
55 int get length() => _window.length; | |
56 DOMWindow get opener() => _createDOMWindowCrossFrame(_window.opener); | |
57 DOMWindow get parent() => _createDOMWindowCrossFrame(_window.parent); | |
58 DOMWindow get top() => _createDOMWindowCrossFrame(_window.top); | |
59 | |
60 // Methods. | |
61 void focus() { | |
62 _window.focus(); | |
63 } | |
64 | |
65 void blur() { | |
66 _window.blur(); | |
67 } | |
68 | |
69 void close() { | |
70 _window.close(); | |
71 } | |
72 | |
73 void postMessage(Dynamic message, | |
74 String targetOrigin, | |
75 [List messagePorts = null]) { | |
76 if (messagePorts == null) { | |
77 _window.postMessage(message, targetOrigin); | |
78 } else { | |
79 _window.postMessage(message, targetOrigin, messagePorts); | |
80 } | |
81 } | |
82 | |
83 // Implementation support. | |
84 _DOMWindowCrossFrameImpl(this._window); | |
85 | |
86 static DOMWindow _createSafe(w) { | |
87 // TODO(vsm): Check if it's the top-level window. Return unwrapped. | |
88 | |
89 // TODO(vsm): Cache or implement equality. | |
90 return new _DOMWindowCrossFrameImpl(w); | |
91 } | |
92 } | |
OLD | NEW |