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 _AudioContextFactoryProvider { | 5 class _AudioContextFactoryProvider { |
6 | 6 |
7 factory AudioContext() native ''' | 7 factory AudioContext() native ''' |
8 var constructor = window.AudioContext || window.webkitAudioContext; | 8 var constructor = window.AudioContext || window.webkitAudioContext; |
9 return new constructor(); | 9 return new constructor(); |
10 '''; | 10 '''; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 static ensureNative(List list) => list; // TODO: make sure. | 71 static ensureNative(List list) => list; // TODO: make sure. |
72 } | 72 } |
73 | 73 |
74 class _CSSMatrixFactoryProvider { | 74 class _CSSMatrixFactoryProvider { |
75 | 75 |
76 factory CSSMatrix([String spec = '']) native | 76 factory CSSMatrix([String spec = '']) native |
77 'return new WebKitCSSMatrix(spec);'; | 77 'return new WebKitCSSMatrix(spec);'; |
78 } | 78 } |
79 | 79 |
80 // TODO(jacobr): this factory does not require any native code so move to a | |
81 // separate file so it can be shared between wrapper and wrapperless versions. | |
82 class _EventFactoryProvider { | |
83 factory Event(String type, [bool canBubble = true, | |
84 bool cancelable = true]) { | |
85 _EventJs e = _document._createEvent("Event"); | |
86 e._initEvent(type, canBubble, cancelable); | |
87 return e; | |
88 } | |
89 } | |
90 | |
91 class _PointFactoryProvider { | 80 class _PointFactoryProvider { |
92 | 81 |
93 factory Point(num x, num y) native 'return new WebKitPoint(x, y);'; | 82 factory Point(num x, num y) native 'return new WebKitPoint(x, y);'; |
94 } | 83 } |
95 | 84 |
96 class _WebSocketFactoryProvider { | 85 class _WebSocketFactoryProvider { |
97 | 86 |
98 factory WebSocket(String url) native 'return new WebSocket(url);'; | 87 factory WebSocket(String url) native 'return new WebSocket(url);'; |
99 } | 88 } |
100 | 89 |
(...skipping 15 matching lines...) Expand all Loading... |
116 (request.status == 200 || request.status == 0)) { | 105 (request.status == 200 || request.status == 0)) { |
117 onSuccess(request); | 106 onSuccess(request); |
118 } | 107 } |
119 }); | 108 }); |
120 | 109 |
121 request.send(); | 110 request.send(); |
122 | 111 |
123 return request; | 112 return request; |
124 } | 113 } |
125 } | 114 } |
OLD | NEW |