OLD | NEW |
(Empty) | |
| 1 class Utils { |
| 2 static List convertToList(List list) { |
| 3 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. |
| 4 final length = list.length; |
| 5 List result = new List(length); |
| 6 result.copyFrom(list, 0, 0, length); |
| 7 return result; |
| 8 } |
| 9 |
| 10 static makeNotImplementedException() { |
| 11 return const NotImplementedException(); |
| 12 } |
| 13 } |
| 14 |
| 15 /* |
| 16 * [NPObjectBase] is native wrapper class injected from embedder's code. |
| 17 */ |
| 18 class NPObject extends DOMWrapperBase { |
| 19 _get(String propertyName) native "NPObject_get"; |
| 20 _invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"
; |
| 21 |
| 22 static _createNPObject() => new NPObject._createNPObject(); |
| 23 NPObject._createNPObject(); |
| 24 } |
| 25 |
| 26 // layoutTestController implementation. |
| 27 // FIXME: provide a separate lib for layoutTestController. |
| 28 |
| 29 var layoutTestController; |
| 30 |
| 31 class LayoutTestController { |
| 32 final NPObject _npObject; |
| 33 |
| 34 LayoutTestController._(this._npObject); |
| 35 |
| 36 dumpAsText() => _npObject._invoke('dumpAsText'); |
| 37 notifyDone() => _npObject._invoke('notifyDone'); |
| 38 setCanOpenWindows() => _npObject._invoke('setCanOpenWindows'); |
| 39 waitUntilDone() => _npObject._invoke('waitUntilDone'); |
| 40 |
| 41 static _initLayoutTestController(var npObject) { |
| 42 layoutTestController = new LayoutTestController._(npObject); |
| 43 } |
| 44 } |
| 45 |
| 46 class DOMWindowCrossFrameImplementation extends DOMType implements DOMWindow { |
| 47 // Fields. |
| 48 History get history() native "DOMWindow_history_cross_frame_Getter"; |
| 49 Location get location() native "DOMWindow_location_cross_frame_Getter"; |
| 50 bool get closed() native "DOMWindow_closed_Getter"; |
| 51 int get length() native "DOMWindow_length_Getter"; |
| 52 DOMWindow get opener() native "DOMWindow_opener_Getter"; |
| 53 DOMWindow get parent() native "DOMWindow_parent_Getter"; |
| 54 DOMWindow get top() native "DOMWindow_top_Getter"; |
| 55 |
| 56 // Methods. |
| 57 void focus() native "DOMWindow_focus_Callback"; |
| 58 void blur() native "DOMWindow_blur_Callback"; |
| 59 void close() native "DOMWindow_close_Callback"; |
| 60 void postMessage([_arg0, _arg1, _arg2]) native "DOMWindow_postMessage_Callback
"; |
| 61 |
| 62 // Implementation support. |
| 63 static DOMWindowCrossFrameImplementation _createDOMWindowCrossFrameImplementat
ion() => new DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImpleme
ntation(); |
| 64 DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImplementation(); |
| 65 |
| 66 String get typeName() => "DOMWindow"; |
| 67 } |
| 68 |
| 69 class HistoryCrossFrameImplementation extends DOMType implements History { |
| 70 // Methods. |
| 71 void back() native "History_back_Callback"; |
| 72 void forward() native "History_forward_Callback"; |
| 73 void go(int distance) native "History_go_Callback"; |
| 74 |
| 75 // Implementation support. |
| 76 static HistoryCrossFrameImplementation _createHistoryCrossFrameImplementation(
) => new HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(
); |
| 77 HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(); |
| 78 |
| 79 String get typeName() => "History"; |
| 80 } |
| 81 |
| 82 class LocationCrossFrameImplementation extends DOMType implements Location { |
| 83 // Fields. |
| 84 void set href(String) native "Location_href_Setter"; |
| 85 |
| 86 // Implementation support. |
| 87 static LocationCrossFrameImplementation _createLocationCrossFrameImplementatio
n() => new LocationCrossFrameImplementation._createLocationCrossFrameImplementat
ion(); |
| 88 LocationCrossFrameImplementation._createLocationCrossFrameImplementation(); |
| 89 |
| 90 String get typeName() => "Location"; |
| 91 } |
OLD | NEW |