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 factory AudioContext() => _wrap(new dom.AudioContext()); | 6 factory AudioContext() => _wrap(new dom.AudioContext()); |
7 } | 7 } |
8 | 8 |
9 class _DOMParserFactoryProvider { | |
10 factory DOMParser() => _wrap(new dom.DOMParser()); | |
11 } | |
12 | |
13 class _FileReaderFactoryProvider { | |
14 factory FileReader() => _wrap(new dom.FileReader()); | |
15 } | |
16 | |
17 class _TypedArrayFactoryProvider { | 9 class _TypedArrayFactoryProvider { |
18 | 10 |
19 factory Float32Array(int length) => _F32(length); | 11 factory Float32Array(int length) => _F32(length); |
20 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list)); | 12 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list)); |
21 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer); | 13 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer); |
22 | 14 |
23 factory Float64Array(int length) => _F64(length); | 15 factory Float64Array(int length) => _F64(length); |
24 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list)); | 16 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list)); |
25 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer); | 17 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer); |
26 | 18 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static Int16Array _I16(arg) => _wrap(new dom.Int16Array(arg)); | 50 static Int16Array _I16(arg) => _wrap(new dom.Int16Array(arg)); |
59 static Int32Array _I32(arg) => _wrap(new dom.Int32Array(arg)); | 51 static Int32Array _I32(arg) => _wrap(new dom.Int32Array(arg)); |
60 static Uint8Array _U8(arg) => _wrap(new dom.Uint8Array(arg)); | 52 static Uint8Array _U8(arg) => _wrap(new dom.Uint8Array(arg)); |
61 static Uint16Array _U16(arg) => _wrap(new dom.Uint16Array(arg)); | 53 static Uint16Array _U16(arg) => _wrap(new dom.Uint16Array(arg)); |
62 static Uint32Array _U32(arg) => _wrap(new dom.Uint32Array(arg)); | 54 static Uint32Array _U32(arg) => _wrap(new dom.Uint32Array(arg)); |
63 static Uint8ClampedArray _U8C(arg) => _wrap(new dom.Uint8ClampedArray(arg)); | 55 static Uint8ClampedArray _U8C(arg) => _wrap(new dom.Uint8ClampedArray(arg)); |
64 | 56 |
65 static ensureNative(List list) => list; // TODO: make sure. | 57 static ensureNative(List list) => list; // TODO: make sure. |
66 } | 58 } |
67 | 59 |
68 class _CSSMatrixFactoryProvider { | |
69 | |
70 factory CSSMatrix([String spec = '']) => | |
71 _wrap(new dom.WebKitCSSMatrix(spec)); | |
72 } | |
73 | |
74 class _PointFactoryProvider { | 60 class _PointFactoryProvider { |
75 | 61 |
76 factory Point(num x, num y) => _wrap(new dom.WebKitPoint(x, y)); | 62 factory Point(num x, num y) => _wrap(new dom.WebKitPoint(x, y)); |
77 } | 63 } |
78 | |
79 class _WebSocketFactoryProvider { | |
80 | |
81 factory WebSocket(String url) => _wrap(new dom.WebSocket(url)); | |
82 } | |
83 | |
84 class _XMLHttpRequestFactoryProvider { | |
85 factory XMLHttpRequest() => _wrap(new dom.XMLHttpRequest()); | |
86 | |
87 factory XMLHttpRequest.getTEMPNAME(String url, | |
88 onSuccess(XMLHttpRequest request)) { | |
89 final request = new XMLHttpRequest(); | |
90 request.open('GET', url, true); | |
91 | |
92 // TODO(terry): Validate after client login added if necessary to forward | |
93 // cookies to server. | |
94 request.withCredentials = true; | |
95 | |
96 // Status 0 is for local XHR request. | |
97 request.on.readyStateChange.add((e) { | |
98 if (request.readyState == XMLHttpRequest.DONE && | |
99 (request.status == 200 || request.status == 0)) { | |
100 onSuccess(request); | |
101 } | |
102 }); | |
103 | |
104 request.send(); | |
105 | |
106 return request; | |
107 } | |
108 } | |
OLD | NEW |