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

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

Issue 10800104: Convert DOM and HTML frog to dart2js. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « lib/html/src/dart2js_LocationWrapper.dart ('k') | lib/html/src/frog_FactoryProviders.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 // TODO(vsm): Add frames to navigate subframes. See 2312.
14
15 bool get closed() => _closed(_window);
16 static bool _closed(win) native "return win.closed;";
17
18 Window get opener() => _createSafe(_opener(_window));
19 static Window _opener(win) native "return win.opener;";
20
21 Window get parent() => _createSafe(_parent(_window));
22 static Window _parent(win) native "return win.parent;";
23
24 Window get top() => _createSafe(_top(_window));
25 static Window _top(win) native "return win.top;";
26
27 // Methods.
28 void focus() => _focus(_window);
29 static void _focus(win) native "win.focus()";
30
31 void blur() => _blur(_window);
32 static void _blur(win) native "win.blur()";
33
34 void close() => _close(_window);
35 static void _close(win) native "win.close()";
36
37 void postMessage(Dynamic message,
38 String targetOrigin,
39 [List messagePorts = null]) {
40 if (messagePorts == null) {
41 _postMessage2(_window, message, targetOrigin);
42 } else {
43 _postMessage3(_window, message, targetOrigin, messagePorts);
44 }
45 }
46
47 // TODO(vsm): This is a hack to workaround dartbug.com/3175. We
48 // need a more robust convention to invoke JS methods on the
49 // underlying window.
50 static void _postMessage2(win, message, targetOrigin) native """
51 win.postMessage(message, targetOrigin);
52 """;
53
54 static void _postMessage3(win, message, targetOrigin, messagePorts) native """
55 win.postMessage(message, targetOrigin, messagePorts);
56 """;
57
58 // Implementation support.
59 _DOMWindowCrossFrameImpl(this._window);
60
61 static Window _createSafe(w) {
62 if (w === window) {
63 return w;
64 } else {
65 // TODO(vsm): Cache or implement equality.
66 return new _DOMWindowCrossFrameImpl(w);
67 }
68 }
69 }
OLDNEW
« no previous file with comments | « lib/html/src/dart2js_LocationWrapper.dart ('k') | lib/html/src/frog_FactoryProviders.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698