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

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

Issue 9464002: Implement automatically generated constructors for frog and dartium dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rerun script Created 8 years, 10 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
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 ''';
11 } 11 }
12 12
13 class _DOMParserFactoryProvider {
14
15 factory DOMParser() native 'return new DOMParser();';
16 }
17
18 class _FileReaderFactoryProvider {
19
20 factory FileReader() native 'return new FileReader();';
21 }
22
23 class _TypedArrayFactoryProvider { 13 class _TypedArrayFactoryProvider {
24 14
25 factory Float32Array(int length) => _F32(length); 15 factory Float32Array(int length) => _F32(length);
26 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list)); 16 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list));
27 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer); 17 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer);
28 18
29 factory Float64Array(int length) => _F64(length); 19 factory Float64Array(int length) => _F64(length);
30 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list)); 20 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list));
31 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer); 21 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer);
32 22
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static Int16Array _I16(arg) native 'return new Int16Array(arg);'; 54 static Int16Array _I16(arg) native 'return new Int16Array(arg);';
65 static Int32Array _I32(arg) native 'return new Int32Array(arg);'; 55 static Int32Array _I32(arg) native 'return new Int32Array(arg);';
66 static Uint8Array _U8(arg) native 'return new Uint8Array(arg);'; 56 static Uint8Array _U8(arg) native 'return new Uint8Array(arg);';
67 static Uint16Array _U16(arg) native 'return new Uint16Array(arg);'; 57 static Uint16Array _U16(arg) native 'return new Uint16Array(arg);';
68 static Uint32Array _U32(arg) native 'return new Uint32Array(arg);'; 58 static Uint32Array _U32(arg) native 'return new Uint32Array(arg);';
69 static Uint8ClampedArray _U8C(arg) native 'return new Uint8ClampedArray(arg);' ; 59 static Uint8ClampedArray _U8C(arg) native 'return new Uint8ClampedArray(arg);' ;
70 60
71 static ensureNative(List list) => list; // TODO: make sure. 61 static ensureNative(List list) => list; // TODO: make sure.
72 } 62 }
73 63
74 class _CSSMatrixFactoryProvider {
75
76 factory CSSMatrix([String spec = '']) native
77 'return new WebKitCSSMatrix(spec);';
78 }
79
80 // TODO(jacobr): this factory does not require any native code so move to a 64 // 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. 65 // separate file so it can be shared between wrapper and wrapperless versions.
82 class _EventFactoryProvider { 66 class _EventFactoryProvider {
83 factory Event(String type, [bool canBubble = true, 67 factory Event(String type, [bool canBubble = true,
84 bool cancelable = true]) { 68 bool cancelable = true]) {
85 _EventJs e = _document._createEvent("Event"); 69 _EventJs e = _document._createEvent("Event");
86 e._initEvent(type, canBubble, cancelable); 70 e._initEvent(type, canBubble, cancelable);
87 return e; 71 return e;
88 } 72 }
89 } 73 }
90 74
91 class _PointFactoryProvider { 75 class _PointFactoryProvider {
92 76
93 factory Point(num x, num y) native 'return new WebKitPoint(x, y);'; 77 factory Point(num x, num y) native 'return new WebKitPoint(x, y);';
94 } 78 }
95
96 class _WebSocketFactoryProvider {
97
98 factory WebSocket(String url) native 'return new WebSocket(url);';
99 }
100
101 class _XMLHttpRequestFactoryProvider {
102 factory XMLHttpRequest() native 'return new XMLHttpRequest();';
103
104 factory XMLHttpRequest.getTEMPNAME(String url,
105 onSuccess(XMLHttpRequest request)) {
106 final request = new XMLHttpRequest();
107 request.open('GET', url, true);
108
109 // TODO(terry): Validate after client login added if necessary to forward
110 // cookies to server.
111 request.withCredentials = true;
112
113 // Status 0 is for local XHR request.
114 request.on.readyStateChange.add((e) {
115 if (request.readyState == XMLHttpRequest.DONE &&
116 (request.status == 200 || request.status == 0)) {
117 onSuccess(request);
118 }
119 });
120
121 request.send();
122
123 return request;
124 }
125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698