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 part of html; | 5 part of html; |
6 | 6 |
7 class _ConsoleVariables { | 7 class _ConsoleVariables { |
8 Map<String, Object> _data = new Map<String, Object>(); | 8 Map<String, Object> _data = new Map<String, Object>(); |
9 | 9 |
10 /** | 10 /** |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return libName.startsWith('dart:'); | 282 return libName.startsWith('dart:'); |
283 } | 283 } |
284 | 284 |
285 static void register(Document document, String tag, Type type, | 285 static void register(Document document, String tag, Type type, |
286 String extendsTagName) { | 286 String extendsTagName) { |
287 // TODO(vsm): Move these checks into native code. | 287 // TODO(vsm): Move these checks into native code. |
288 ClassMirror cls = reflectClass(type); | 288 ClassMirror cls = reflectClass(type); |
289 if (_isBuiltinType(cls)) { | 289 if (_isBuiltinType(cls)) { |
290 throw new UnsupportedError("Invalid custom element from $libName."); | 290 throw new UnsupportedError("Invalid custom element from $libName."); |
291 } | 291 } |
| 292 var className = MirrorSystem.getName(cls.simpleName); |
| 293 if (!cls.constructors.containsKey(new Symbol('$className.created'))) { |
| 294 throw new UnsupportedError('Class is missing constructor $className.create
d'); |
| 295 } |
292 _register(document, tag, type, extendsTagName); | 296 _register(document, tag, type, extendsTagName); |
293 } | 297 } |
294 | 298 |
295 static void _register(Document document, String tag, Type customType, | 299 static void _register(Document document, String tag, Type customType, |
296 String extendsTagName) native "Utils_register"; | 300 String extendsTagName) native "Utils_register"; |
297 | 301 |
298 static Element createElement(Document document, String tagName) native "Utils_
createElement"; | 302 static Element createElement(Document document, String tagName) native "Utils_
createElement"; |
| 303 |
| 304 static void initializeCustomElement(HtmlElement element) native "Utils_initial
izeCustomElement"; |
299 } | 305 } |
300 | 306 |
301 class _NPObject extends NativeFieldWrapperClass1 { | 307 class _NPObject extends NativeFieldWrapperClass1 { |
302 _NPObject.internal(); | 308 _NPObject.internal(); |
303 static _NPObject retrieve(String key) native "NPObject_retrieve"; | 309 static _NPObject retrieve(String key) native "NPObject_retrieve"; |
304 property(String propertyName) native "NPObject_property"; | 310 property(String propertyName) native "NPObject_property"; |
305 invoke(String methodName, [List args = null]) native "NPObject_invoke"; | 311 invoke(String methodName, [List args = null]) native "NPObject_invoke"; |
306 } | 312 } |
307 | 313 |
308 class _DOMWindowCrossFrame extends NativeFieldWrapperClass1 implements | 314 class _DOMWindowCrossFrame extends NativeFieldWrapperClass1 implements |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 _send(msg) { | 516 _send(msg) { |
511 _sendToHelperIsolate(msg, _sendPort); | 517 _sendToHelperIsolate(msg, _sendPort); |
512 } | 518 } |
513 | 519 |
514 bool get isActive => _isActive; | 520 bool get isActive => _isActive; |
515 } | 521 } |
516 | 522 |
517 get _pureIsolateTimerFactoryClosure => | 523 get _pureIsolateTimerFactoryClosure => |
518 ((int milliSeconds, void callback(Timer time), bool repeating) => | 524 ((int milliSeconds, void callback(Timer time), bool repeating) => |
519 new _PureIsolateTimer(milliSeconds, callback, repeating)); | 525 new _PureIsolateTimer(milliSeconds, callback, repeating)); |
| 526 |
| 527 void _initializeCustomElement(Element e) { |
| 528 _Utils.initializeCustomElement(e); |
| 529 } |
OLD | NEW |