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

Side by Side Diff: tools/dom/src/html_native_DOMImplementation.dart

Issue 254463006: This CL contains all of the changes for splitting off all of the native (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Additional cleanup, eliminate now unused generality Created 6 years, 8 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 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 static Element getAndValidateNativeType(Type type, String tagName) { 100 static Element getAndValidateNativeType(Type type, String tagName) {
101 var element = new Element.tag(tagName); 101 var element = new Element.tag(tagName);
102 if (!isTypeSubclassOf(type, element.runtimeType)) { 102 if (!isTypeSubclassOf(type, element.runtimeType)) {
103 return null; 103 return null;
104 } 104 }
105 return element; 105 return element;
106 } 106 }
107 107
108 static window() native "Utils_window"; 108 static window() => blink.Native_Utils_window();
109 static forwardingPrint(String message) native "Utils_forwardingPrint"; 109 static forwardingPrint(String message) => blink.Native_Utils_forwardingPrint(m essage);
110 // TODO(vsm): Make this API compatible with spawnUri. It should also 110 // TODO(vsm): Make this API compatible with spawnUri. It should also
111 // return a Future<Isolate>. 111 // return a Future<Isolate>.
112 static spawnDomUri(String uri) native "Utils_spawnDomUri"; 112 static spawnDomUri(String uri) => blink.Native_Utils_spawnDomUri(uri);
113 113
114 // The following methods were added for debugger integration to make working 114 // The following methods were added for debugger integration to make working
115 // with the Dart C mirrors API simpler. 115 // with the Dart C mirrors API simpler.
116 // TODO(jacobr): consider moving them to a separate library. 116 // TODO(jacobr): consider moving them to a separate library.
117 // If Dart supported dynamic code injection, we would only inject this code 117 // If Dart supported dynamic code injection, we would only inject this code
118 // when the debugger is invoked. 118 // when the debugger is invoked.
119 119
120 /** 120 /**
121 * Strips the private secret prefix from member names of the form 121 * Strips the private secret prefix from member names of the form
122 * someName@hash. 122 * someName@hash.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (nativeClass.reflectedType != HtmlElement) { 404 if (nativeClass.reflectedType != HtmlElement) {
405 throw new UnsupportedError('Class must provide extendsTag if base ' 405 throw new UnsupportedError('Class must provide extendsTag if base '
406 'native class is not HTMLElement'); 406 'native class is not HTMLElement');
407 } 407 }
408 } 408 }
409 409
410 _register(document, tag, type, extendsTagName); 410 _register(document, tag, type, extendsTagName);
411 } 411 }
412 412
413 static void _register(Document document, String tag, Type customType, 413 static void _register(Document document, String tag, Type customType,
414 String extendsTagName) native "Utils_register"; 414 String extendsTagName) => blink.Native_Utils_register(document, tag, customT ype, extendsTagName);
415 415
416 static Element createElement(Document document, String tagName) native "Utils_ createElement"; 416 static Element createElement(Document document, String tagName) =>
417 blink.Native_Utils_createElement(document, tagName);
417 418
418 static void initializeCustomElement(HtmlElement element) native "Utils_initial izeCustomElement"; 419 static void initializeCustomElement(HtmlElement element) =>
420 blink.Native_Utils_initializeCustomElement(element);
419 421
420 static void changeElementWrapper(HtmlElement element, Type type) native "Utils _changeElementWrapper"; 422 static void changeElementWrapper(HtmlElement element, Type type) =>
423 blink.Native_Utils_changeElementWrapper(element, type);
421 } 424 }
422 425
423 class _DOMWindowCrossFrame extends NativeFieldWrapperClass2 implements 426 class _DOMWindowCrossFrame extends NativeFieldWrapperClass2 implements
424 WindowBase { 427 WindowBase {
425 _DOMWindowCrossFrame.internal(); 428 _DOMWindowCrossFrame.internal();
426 429
427 // Fields. 430 // Fields.
428 HistoryBase get history native "Window_history_cross_frame_Getter"; 431 HistoryBase get history => blink.Native_DOMWindowCrossFrame_get_history(this);
429 LocationBase get location native "Window_location_cross_frame_Getter"; 432 LocationBase get location => blink.Native_DOMWindowCrossFrame_get_location(thi s);
430 bool get closed native "Window_closed_Getter"; 433 bool get closed => blink.Native_DOMWindowCrossFrame_get_closed(this);
431 int get length native "Window_length_Getter"; 434 WindowBase get opener => blink.Native_DOMWindowCrossFrame_get_opener(this);
432 WindowBase get opener native "Window_opener_Getter"; 435 WindowBase get parent => blink.Native_DOMWindowCrossFrame_get_parent(this);
433 WindowBase get parent native "Window_parent_Getter"; 436 WindowBase get top => blink.Native_DOMWindowCrossFrame_get_top(this);
434 WindowBase get top native "Window_top_Getter";
435 437
436 // Methods. 438 // Methods.
437 void close() native "Window_close_Callback"; 439 void close() => blink.Native_DOMWindowCrossFrame_close(this);
438 void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) native "Window_postMessage_Callback"; 440 void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts]) =>
441 blink.Native_DOMWindowCrossFrame_postMessage(this, message, targetOrigin, me ssagePorts);
439 442
440 // Implementation support. 443 // Implementation support.
441 String get typeName => "Window"; 444 String get typeName => "Window";
442 445
443 // TODO(efortuna): Remove this method. dartbug.com/16814 446 // TODO(efortuna): Remove this method. dartbug.com/16814
444 Events get on => throw new UnsupportedError( 447 Events get on => throw new UnsupportedError(
445 'You can only attach EventListeners to your own window.'); 448 'You can only attach EventListeners to your own window.');
446 // TODO(efortuna): Remove this method. dartbug.com/16814 449 // TODO(efortuna): Remove this method. dartbug.com/16814
447 void addEventListener(String type, EventListener listener, [bool useCapture]) 450 void addEventListener(String type, EventListener listener, [bool useCapture])
448 => throw new UnsupportedError( 451 => throw new UnsupportedError(
449 'You can only attach EventListeners to your own window.'); 452 'You can only attach EventListeners to your own window.');
450 // TODO(efortuna): Remove this method. dartbug.com/16814 453 // TODO(efortuna): Remove this method. dartbug.com/16814
451 bool dispatchEvent(Event event) => throw new UnsupportedError( 454 bool dispatchEvent(Event event) => throw new UnsupportedError(
452 'You can only attach EventListeners to your own window.'); 455 'You can only attach EventListeners to your own window.');
453 // TODO(efortuna): Remove this method. dartbug.com/16814 456 // TODO(efortuna): Remove this method. dartbug.com/16814
454 void removeEventListener(String type, EventListener listener, 457 void removeEventListener(String type, EventListener listener,
455 [bool useCapture]) => throw new UnsupportedError( 458 [bool useCapture]) => throw new UnsupportedError(
456 'You can only attach EventListeners to your own window.'); 459 'You can only attach EventListeners to your own window.');
457 } 460 }
458 461
459 class _HistoryCrossFrame extends NativeFieldWrapperClass2 implements HistoryBase { 462 class _HistoryCrossFrame extends NativeFieldWrapperClass2 implements HistoryBase {
460 _HistoryCrossFrame.internal(); 463 _HistoryCrossFrame.internal();
461 464
462 // Methods. 465 // Methods.
463 void back() native "History_back_Callback"; 466 void back() => blink.Native_HistoryCrossFrame_back(this);
464 void forward() native "History_forward_Callback"; 467 void forward() => blink.Native_HistoryCrossFrame_forward(this);
465 void go(int distance) native "History_go_Callback"; 468 void go(int distance) => blink.Native_HistoryCrossFrame_go(this, distance);
466 469
467 // Implementation support. 470 // Implementation support.
468 String get typeName => "History"; 471 String get typeName => "History";
469 } 472 }
470 473
471 class _LocationCrossFrame extends NativeFieldWrapperClass2 implements LocationBa se { 474 class _LocationCrossFrame extends NativeFieldWrapperClass2 implements LocationBa se {
472 _LocationCrossFrame.internal(); 475 _LocationCrossFrame.internal();
473 476
474 // Fields. 477 // Fields.
475 void set href(String) native "Location_href_Setter"; 478 void set href(String h) => blink.Native_LocationCrossFrame_set_href(this, h);
476 479
477 // Implementation support. 480 // Implementation support.
478 String get typeName => "Location"; 481 String get typeName => "Location";
479 } 482 }
480 483
481 class _DOMStringMap extends NativeFieldWrapperClass2 implements Map<String, Stri ng> { 484 class _DOMStringMap extends NativeFieldWrapperClass2 implements Map<String, Stri ng> {
482 _DOMStringMap.internal(); 485 _DOMStringMap.internal();
483 486
484 bool containsValue(String value) => Maps.containsValue(this, value); 487 bool containsValue(String value) => Maps.containsValue(this, value);
485 bool containsKey(String key) native "DOMStringMap_containsKey_Callback"; 488 bool containsKey(String key) => blink.Native_DOMStringMap_containsKey(this, ke y);
486 String operator [](String key) native "DOMStringMap_item_Callback"; 489 String operator [](String key) => blink.Native_DOMStringMap_item(this, key);
487 void operator []=(String key, String value) native "DOMStringMap_setItem_Callb ack"; 490 void operator []=(String key, String value) => blink.Native_DOMStringMap_setIt em(this, key, value);
488 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke y, ifAbsent); 491 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke y, ifAbsent);
489 String remove(String key) native "DOMStringMap_remove_Callback"; 492 String remove(String key) => blink.Native_DOMStringMap_remove(this, key);
490 void clear() => Maps.clear(this); 493 void clear() => Maps.clear(this);
491 void forEach(void f(String key, String value)) => Maps.forEach(this, f); 494 void forEach(void f(String key, String value)) => Maps.forEach(this, f);
492 Iterable<String> get keys native "DOMStringMap_getKeys_Callback"; 495 Iterable<String> get keys => blink.Native_DOMStringMap_get_keys(this, keys);
493 Iterable<String> get values => Maps.getValues(this); 496 Iterable<String> get values => Maps.getValues(this);
494 int get length => Maps.length(this); 497 int get length => Maps.length(this);
495 bool get isEmpty => Maps.isEmpty(this); 498 bool get isEmpty => Maps.isEmpty(this);
496 bool get isNotEmpty => Maps.isNotEmpty(this); 499 bool get isNotEmpty => Maps.isNotEmpty(this);
497 void addAll(Map<String, String> other) { 500 void addAll(Map<String, String> other) {
498 other.forEach((key, value) => this[key] = value); 501 other.forEach((key, value) => this[key] = value);
499 } 502 }
500 } 503 }
501 504
502 final _printClosure = window.console.log; 505 final _printClosure = window.console.log;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 _scheduleImmediateHelper._schedule(callback); 599 _scheduleImmediateHelper._schedule(callback);
597 }; 600 };
598 601
599 get _pureIsolateScheduleImmediateClosure => ((void callback()) => 602 get _pureIsolateScheduleImmediateClosure => ((void callback()) =>
600 throw new UnimplementedError("scheduleMicrotask in background isolates " 603 throw new UnimplementedError("scheduleMicrotask in background isolates "
601 "are not supported in the browser")); 604 "are not supported in the browser"));
602 605
603 void _initializeCustomElement(Element e) { 606 void _initializeCustomElement(Element e) {
604 _Utils.initializeCustomElement(e); 607 _Utils.initializeCustomElement(e);
605 } 608 }
OLDNEW
« no previous file with comments | « tools/dom/src/blink_native_DOMImplementation.dart ('k') | tools/dom/templates/html/dartium/blink_dartium.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698