OLD | NEW |
(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 Utils { |
| 6 static List convertToList(List list) { |
| 7 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. |
| 8 final length = list.length; |
| 9 List result = new List(length); |
| 10 result.copyFrom(list, 0, 0, length); |
| 11 return result; |
| 12 } |
| 13 |
| 14 static makeNotImplementedException() { |
| 15 return const NotImplementedException(); |
| 16 } |
| 17 |
| 18 static window() native "TopLevel_Window"; |
| 19 |
| 20 static SendPort spawnDomIsolate(Window window, String entryPoint) native "Util
s_spawnDomIsolate"; |
| 21 } |
| 22 |
| 23 /* |
| 24 * [NPObjectBase] is native wrapper class injected from embedder's code. |
| 25 */ |
| 26 class NPObject extends DOMWrapperBase { |
| 27 static NPObject retrieve(String key) native "NPObject_retrieve"; |
| 28 property(String propertyName) native "NPObject_property"; |
| 29 invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"; |
| 30 |
| 31 static _createNPObject() => new NPObject._createNPObject(); |
| 32 NPObject._createNPObject(); |
| 33 } |
| 34 |
| 35 class DOMWindowCrossFrameImplementation extends DOMWrapperBase implements DOMWin
dow { |
| 36 // Fields. |
| 37 History get history() native "DOMWindow_history_cross_frame_Getter"; |
| 38 Location get location() native "DOMWindow_location_cross_frame_Getter"; |
| 39 bool get closed() native "DOMWindow_closed_Getter"; |
| 40 int get length() native "DOMWindow_length_Getter"; |
| 41 DOMWindow get opener() native "DOMWindow_opener_Getter"; |
| 42 DOMWindow get parent() native "DOMWindow_parent_Getter"; |
| 43 DOMWindow get top() native "DOMWindow_top_Getter"; |
| 44 |
| 45 // Methods. |
| 46 void focus() native "DOMWindow_focus_Callback"; |
| 47 void blur() native "DOMWindow_blur_Callback"; |
| 48 void close() native "DOMWindow_close_Callback"; |
| 49 void postMessage([_arg0, _arg1, _arg2]) native "DOMWindow_postMessage_Callback
"; |
| 50 |
| 51 // Implementation support. |
| 52 static DOMWindowCrossFrameImplementation _createDOMWindowCrossFrameImplementat
ion() => new DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImpleme
ntation(); |
| 53 DOMWindowCrossFrameImplementation._createDOMWindowCrossFrameImplementation(); |
| 54 |
| 55 String get typeName() => "DOMWindow"; |
| 56 } |
| 57 |
| 58 class HistoryCrossFrameImplementation extends DOMWrapperBase implements History
{ |
| 59 // Methods. |
| 60 void back() native "History_back_Callback"; |
| 61 void forward() native "History_forward_Callback"; |
| 62 void go(int distance) native "History_go_Callback"; |
| 63 |
| 64 // Implementation support. |
| 65 static HistoryCrossFrameImplementation _createHistoryCrossFrameImplementation(
) => new HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(
); |
| 66 HistoryCrossFrameImplementation._createHistoryCrossFrameImplementation(); |
| 67 |
| 68 String get typeName() => "History"; |
| 69 } |
| 70 |
| 71 class LocationCrossFrameImplementation extends DOMWrapperBase implements Locatio
n { |
| 72 // Fields. |
| 73 void set href(String) native "Location_href_Setter"; |
| 74 |
| 75 // Implementation support. |
| 76 static LocationCrossFrameImplementation _createLocationCrossFrameImplementatio
n() => new LocationCrossFrameImplementation._createLocationCrossFrameImplementat
ion(); |
| 77 LocationCrossFrameImplementation._createLocationCrossFrameImplementation(); |
| 78 |
| 79 String get typeName() => "Location"; |
| 80 } |
OLD | NEW |