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

Side by Side Diff: tools/dom/src/dart2js_DOMImplementation.dart

Issue 2827793002: Format all files under tools and utils directory. (Closed)
Patch Set: Format all files under tools and utils directory. Created 3 years, 8 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
« no previous file with comments | « tools/dom/src/dart2js_CustomElementSupport.dart ('k') | tools/dom/src/dart2js_KeyEvent.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of html; 5 part of html;
6 6
7 // TODO(vsm): Unify with Dartium version. 7 // TODO(vsm): Unify with Dartium version.
8 class _DOMWindowCrossFrame implements WindowBase { 8 class _DOMWindowCrossFrame implements WindowBase {
9 // Private window. Note, this is a window in another frame, so it 9 // Private window. Note, this is a window in another frame, so it
10 // cannot be typed as "Window" as its prototype is not patched 10 // cannot be typed as "Window" as its prototype is not patched
11 // properly. Its fields and methods can only be accessed via JavaScript. 11 // properly. Its fields and methods can only be accessed via JavaScript.
12 final _window; 12 final _window;
13 13
14 // Fields. 14 // Fields.
15 HistoryBase get history => 15 HistoryBase get history =>
16 _HistoryCrossFrame._createSafe(JS('HistoryBase', '#.history', _window)); 16 _HistoryCrossFrame._createSafe(JS('HistoryBase', '#.history', _window));
17 LocationBase get location => 17 LocationBase get location => _LocationCrossFrame
18 _LocationCrossFrame._createSafe(JS('LocationBase', '#.location', _window)); 18 ._createSafe(JS('LocationBase', '#.location', _window));
19 19
20 // TODO(vsm): Add frames to navigate subframes. See 2312. 20 // TODO(vsm): Add frames to navigate subframes. See 2312.
21 21
22 bool get closed => JS('bool', '#.closed', _window); 22 bool get closed => JS('bool', '#.closed', _window);
23 23
24 WindowBase get opener => _createSafe(JS('WindowBase', '#.opener', _window)); 24 WindowBase get opener => _createSafe(JS('WindowBase', '#.opener', _window));
25 25
26 WindowBase get parent => _createSafe(JS('WindowBase', '#.parent', _window)); 26 WindowBase get parent => _createSafe(JS('WindowBase', '#.parent', _window));
27 27
28 WindowBase get top => _createSafe(JS('WindowBase', '#.top', _window)); 28 WindowBase get top => _createSafe(JS('WindowBase', '#.top', _window));
29 29
30 // Methods. 30 // Methods.
31 void close() => JS('void', '#.close()', _window); 31 void close() => JS('void', '#.close()', _window);
32 32
33 void postMessage(var message, String targetOrigin, [List messagePorts = null]) { 33 void postMessage(var message, String targetOrigin,
34 [List messagePorts = null]) {
34 if (messagePorts == null) { 35 if (messagePorts == null) {
35 JS('void', '#.postMessage(#,#)', _window, 36 JS('void', '#.postMessage(#,#)', _window,
36 convertDartToNative_SerializedScriptValue(message), targetOrigin); 37 convertDartToNative_SerializedScriptValue(message), targetOrigin);
37 } else { 38 } else {
38 JS('void', '#.postMessage(#,#,#)', _window, 39 JS(
39 convertDartToNative_SerializedScriptValue(message), targetOrigin, 40 'void',
41 '#.postMessage(#,#,#)',
42 _window,
43 convertDartToNative_SerializedScriptValue(message),
44 targetOrigin,
40 messagePorts); 45 messagePorts);
41 } 46 }
42 } 47 }
43 48
44 // Implementation support. 49 // Implementation support.
45 _DOMWindowCrossFrame(this._window); 50 _DOMWindowCrossFrame(this._window);
46 51
47 static WindowBase _createSafe(w) { 52 static WindowBase _createSafe(w) {
48 if (identical(w, window)) { 53 if (identical(w, window)) {
49 return w; 54 return w;
50 } else { 55 } else {
51 // TODO(vsm): Cache or implement equality. 56 // TODO(vsm): Cache or implement equality.
52 return new _DOMWindowCrossFrame(w); 57 return new _DOMWindowCrossFrame(w);
53 } 58 }
54 } 59 }
55 60
56 // TODO(efortuna): Remove this method. dartbug.com/16814 61 // TODO(efortuna): Remove this method. dartbug.com/16814
57 Events get on => throw new UnsupportedError( 62 Events get on => throw new UnsupportedError(
58 'You can only attach EventListeners to your own window.'); 63 'You can only attach EventListeners to your own window.');
59 // TODO(efortuna): Remove this method. dartbug.com/16814 64 // TODO(efortuna): Remove this method. dartbug.com/16814
60 void _addEventListener(String type, EventListener listener, [bool useCapture]) 65 void _addEventListener(String type, EventListener listener,
61 => throw new UnsupportedError( 66 [bool useCapture]) =>
62 'You can only attach EventListeners to your own window.'); 67 throw new UnsupportedError(
68 'You can only attach EventListeners to your own window.');
63 // TODO(efortuna): Remove this method. dartbug.com/16814 69 // TODO(efortuna): Remove this method. dartbug.com/16814
64 void addEventListener(String type, EventListener listener, [bool useCapture]) 70 void addEventListener(String type, EventListener listener,
65 => throw new UnsupportedError( 71 [bool useCapture]) =>
66 'You can only attach EventListeners to your own window.'); 72 throw new UnsupportedError(
73 'You can only attach EventListeners to your own window.');
67 // TODO(efortuna): Remove this method. dartbug.com/16814 74 // TODO(efortuna): Remove this method. dartbug.com/16814
68 bool dispatchEvent(Event event) => throw new UnsupportedError( 75 bool dispatchEvent(Event event) => throw new UnsupportedError(
69 'You can only attach EventListeners to your own window.'); 76 'You can only attach EventListeners to your own window.');
70 // TODO(efortuna): Remove this method. dartbug.com/16814 77 // TODO(efortuna): Remove this method. dartbug.com/16814
71 void _removeEventListener(String type, EventListener listener, 78 void _removeEventListener(String type, EventListener listener,
72 [bool useCapture]) => throw new UnsupportedError( 79 [bool useCapture]) =>
73 'You can only attach EventListeners to your own window.'); 80 throw new UnsupportedError(
81 'You can only attach EventListeners to your own window.');
74 // TODO(efortuna): Remove this method. dartbug.com/16814 82 // TODO(efortuna): Remove this method. dartbug.com/16814
75 void removeEventListener(String type, EventListener listener, 83 void removeEventListener(String type, EventListener listener,
76 [bool useCapture]) => throw new UnsupportedError( 84 [bool useCapture]) =>
85 throw new UnsupportedError(
77 'You can only attach EventListeners to your own window.'); 86 'You can only attach EventListeners to your own window.');
78 } 87 }
79 88
80 class _LocationCrossFrame implements LocationBase { 89 class _LocationCrossFrame implements LocationBase {
81 // Private location. Note, this is a location object in another frame, so it 90 // Private location. Note, this is a location object in another frame, so it
82 // cannot be typed as "Location" as its prototype is not patched 91 // cannot be typed as "Location" as its prototype is not patched
83 // properly. Its fields and methods can only be accessed via JavaScript. 92 // properly. Its fields and methods can only be accessed via JavaScript.
84 var _location; 93 var _location;
85 94
86 set href(String val) => _setHref(_location, val); 95 set href(String val) => _setHref(_location, val);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 127
119 static HistoryBase _createSafe(h) { 128 static HistoryBase _createSafe(h) {
120 if (identical(h, window.history)) { 129 if (identical(h, window.history)) {
121 return h; 130 return h;
122 } else { 131 } else {
123 // TODO(vsm): Cache or implement equality. 132 // TODO(vsm): Cache or implement equality.
124 return new _HistoryCrossFrame(h); 133 return new _HistoryCrossFrame(h);
125 } 134 }
126 } 135 }
127 } 136 }
OLDNEW
« no previous file with comments | « tools/dom/src/dart2js_CustomElementSupport.dart ('k') | tools/dom/src/dart2js_KeyEvent.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698