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

Side by Side Diff: client/html/src/dartium_FactoryProviders.dart

Issue 9537001: Generate dart:html bindings for Dartium as well as Frog. All unittests now pass (or are disabled fo… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
(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 class _AudioContextFactoryProvider {
6 factory AudioContext() => _wrap(new dom.AudioContext());
7 }
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 {
18
19 factory Float32Array(int length) => _F32(length);
20 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list));
21 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer);
22
23 factory Float64Array(int length) => _F64(length);
24 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list));
25 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer);
26
27 factory Int8Array(int length) => _I8(length);
28 factory Int8Array.fromList(List<num> list) => _I8(ensureNative(list));
29 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _I8(buffer);
30
31 factory Int16Array(int length) => _I16(length);
32 factory Int16Array.fromList(List<num> list) => _I16(ensureNative(list));
33 factory Int16Array.fromBuffer(ArrayBuffer buffer) => _I16(buffer);
34
35 factory Int32Array(int length) => _I32(length);
36 factory Int32Array.fromList(List<num> list) => _I32(ensureNative(list));
37 factory Int32Array.fromBuffer(ArrayBuffer buffer) => _I32(buffer);
38
39 factory Uint8Array(int length) => _U8(length);
40 factory Uint8Array.fromList(List<num> list) => _U8(ensureNative(list));
41 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _U8(buffer);
42
43 factory Uint16Array(int length) => _U16(length);
44 factory Uint16Array.fromList(List<num> list) => _U16(ensureNative(list));
45 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _U16(buffer);
46
47 factory Uint32Array(int length) => _U32(length);
48 factory Uint32Array.fromList(List<num> list) => _U32(ensureNative(list));
49 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _U32(buffer);
50
51 factory Uint8ClampedArray(int length) => _U8C(length);
52 factory Uint8ClampedArray.fromList(List<num> list) => _U8C(ensureNative(list)) ;
53 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer) => _U8C(buffer);
54
55 static Float32Array _F32(arg) => _wrap(new dom.Float32Array(arg));
56 static Float64Array _F64(arg) => _wrap(new dom.Float64Array(arg));
57 static Int8Array _I8(arg) => _wrap(new dom.Int8Array(arg));
58 static Int16Array _I16(arg) => _wrap(new dom.Int16Array(arg));
59 static Int32Array _I32(arg) => _wrap(new dom.Int32Array(arg));
60 static Uint8Array _U8(arg) => _wrap(new dom.Uint8Array(arg));
61 static Uint16Array _U16(arg) => _wrap(new dom.Uint16Array(arg));
62 static Uint32Array _U32(arg) => _wrap(new dom.Uint32Array(arg));
63 static Uint8ClampedArray _U8C(arg) => _wrap(new dom.Uint8ClampedArray(arg));
64
65 static ensureNative(List list) => list; // TODO: make sure.
66 }
67
68 class _CSSMatrixFactoryProvider {
69
70 factory CSSMatrix([String spec = '']) =>
71 _wrap(new dom.WebKitCSSMatrix(spec));
72 }
73
74 class _PointFactoryProvider {
75
76 factory Point(num x, num y) => _wrap(new dom.WebKitPoint(x, y));
77 }
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698