| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // TODO(vsm): Unify with Dartium version. |
| 6 class _DOMWindowCrossFrameImpl implements Window { |
| 7 // Private window. |
| 8 _WindowImpl _window; |
| 9 |
| 10 // Fields. |
| 11 // TODO(vsm): Implement history and location getters. |
| 12 |
| 13 bool get closed() => _window.closed; |
| 14 int get length() => _window.length; |
| 15 Window get opener() => _createSafe(_window.opener); |
| 16 Window get parent() => _createSafe(_window.parent); |
| 17 Window get top() => _createSafe(_window.top); |
| 18 |
| 19 // Methods. |
| 20 void focus() => _window.focus(); |
| 21 |
| 22 void blur() => _window.blur(); |
| 23 |
| 24 void close() => _window.close(); |
| 25 |
| 26 void postMessage(Dynamic message, |
| 27 String targetOrigin, |
| 28 [List messagePorts = null]) { |
| 29 if (messagePorts == null) { |
| 30 _window.postMessage(message, targetOrigin); |
| 31 } else { |
| 32 _window.postMessage(message, targetOrigin, messagePorts); |
| 33 } |
| 34 } |
| 35 |
| 36 // Implementation support. |
| 37 _DOMWindowCrossFrameImpl(this._window); |
| 38 |
| 39 static Window _createSafe(w) { |
| 40 if (w === window) { |
| 41 return w; |
| 42 } else { |
| 43 // TODO(vsm): Cache or implement equality. |
| 44 return new _DOMWindowCrossFrameImpl(w); |
| 45 } |
| 46 } |
| 47 } |
| OLD | NEW |