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

Side by Side Diff: lib/html/src/frog_DOMImplementation.dart

Issue 10601003: Enable cross frame window operations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 (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 // TODO(vsm): Unify with Dartium version. 5 // TODO(vsm): Unify with Dartium version.
6 class _DOMWindowCrossFrameImpl implements Window { 6 class _DOMWindowCrossFrameImpl implements Window {
7 // Private window. 7 // Private window.
8 _WindowImpl _window; 8 _WindowImpl _window;
9 9
10 // Fields. 10 // Fields.
11 // TODO(vsm): Implement history and location getters. 11 // TODO(vsm): Implement history and location getters.
12 12
13 bool get closed() => _window.closed; 13 bool get closed() => _closed(_window);
14 int get length() => _window.length; 14 static bool _closed(win) native "return win.closed;";
15 Window get opener() => _createSafe(_window.opener); 15
16 Window get parent() => _createSafe(_window.parent); 16 bool get length() => _length(_window);
sra1 2012/06/21 16:18:01 Since there is no indexer, there is no point to le
17 Window get top() => _createSafe(_window.top); 17 static bool _length(win) native "return win.length;";
18
19 Window get opener() => _createSafe(_opener(_window));
20 static Window _opener(win) native "return win.opener;";
21
22 Window get parent() => _createSafe(_parent(_window));
23 static Window _parent(win) native "return win.parent;";
24
25 Window get top() => _createSafe(_top(_window));
26 static Window _top(win) native "return win.top;";
18 27
19 // Methods. 28 // Methods.
20 void focus() => _window.focus(); 29 void focus() => _focus(_window);
30 static void _focus(win) native "win.focus()";
21 31
22 void blur() => _window.blur(); 32 void blur() => _blur(_window);
33 static void _blur(win) native "win.blur()";
23 34
24 void close() => _window.close(); 35 void close() => _close(_window);
36 static void _close(win) native "win.close()";
25 37
26 void postMessage(Dynamic message, 38 void postMessage(Dynamic message,
27 String targetOrigin, 39 String targetOrigin,
28 [List messagePorts = null]) { 40 [List messagePorts = null]) {
29 if (messagePorts == null) { 41 if (messagePorts == null) {
30 _postMessage2(_window, message, targetOrigin); 42 _postMessage2(_window, message, targetOrigin);
31 } else { 43 } else {
32 _postMessage3(_window, message, targetOrigin, messagePorts); 44 _postMessage3(_window, message, targetOrigin, messagePorts);
33 } 45 }
34 } 46 }
(...skipping 14 matching lines...) Expand all
49 61
50 static Window _createSafe(w) { 62 static Window _createSafe(w) {
51 if (w === window) { 63 if (w === window) {
52 return w; 64 return w;
53 } else { 65 } else {
54 // TODO(vsm): Cache or implement equality. 66 // TODO(vsm): Cache or implement equality.
55 return new _DOMWindowCrossFrameImpl(w); 67 return new _DOMWindowCrossFrameImpl(w);
56 } 68 }
57 } 69 }
58 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698