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

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

Issue 2827793002: Format all files under tools and utils directory. (Closed)
Patch Set: Format all files under tools and utils directory. Created 3 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
« no previous file with comments | « tools/dom/src/dartium_WrappedEvent.dart ('k') | tools/dom/src/shared_SVGFactoryProviders.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 _Property { 7 class _Property {
8 _Property(this.name) 8 _Property(this.name)
9 : _hasValue = false, 9 : _hasValue = false,
10 writable = false, 10 writable = false,
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 /** 578 /**
579 * Returns a list of completions to use if the receiver is o. 579 * Returns a list of completions to use if the receiver is o.
580 */ 580 */
581 static List<String> getCompletions(o) { 581 static List<String> getCompletions(o) {
582 MirrorSystem system = currentMirrorSystem(); 582 MirrorSystem system = currentMirrorSystem();
583 var completions = new Set<String>(); 583 var completions = new Set<String>();
584 addAll(Map<Symbol, dynamic> map, bool isStatic) { 584 addAll(Map<Symbol, dynamic> map, bool isStatic) {
585 map.forEach((symbol, mirror) { 585 map.forEach((symbol, mirror) {
586 if (mirror.isStatic == isStatic && !mirror.isPrivate) { 586 if (mirror.isStatic == isStatic && !mirror.isPrivate) {
587 var name = MirrorSystem.getName(symbol); 587 var name = MirrorSystem.getName(symbol);
588 if (mirror is MethodMirror && mirror.isSetter) name = 588 if (mirror is MethodMirror && mirror.isSetter)
589 name.substring(0, name.length - 1); 589 name = name.substring(0, name.length - 1);
590 completions.add(name); 590 completions.add(name);
591 } 591 }
592 }); 592 });
593 } 593 }
594 594
595 addForClass(ClassMirror mirror, bool isStatic) { 595 addForClass(ClassMirror mirror, bool isStatic) {
596 if (mirror == null) return; 596 if (mirror == null) return;
597 addAll(mirror.declarations, isStatic); 597 addAll(mirror.declarations, isStatic);
598 if (mirror.superclass != null) addForClass(mirror.superclass, isStatic); 598 if (mirror.superclass != null) addForClass(mirror.superclass, isStatic);
599 for (var interface in mirror.superinterfaces) { 599 for (var interface in mirror.superinterfaces) {
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1067
1068 class _DOMWindowCrossFrame extends DartHtmlDomObject implements WindowBase { 1068 class _DOMWindowCrossFrame extends DartHtmlDomObject implements WindowBase {
1069 _DOMWindowCrossFrame.internal(); 1069 _DOMWindowCrossFrame.internal();
1070 1070
1071 static _createSafe(win) { 1071 static _createSafe(win) {
1072 if (identical(win, window)) { 1072 if (identical(win, window)) {
1073 // The current Window object is the only window object that should not 1073 // The current Window object is the only window object that should not
1074 // use _DOMWindowCrossFrame. 1074 // use _DOMWindowCrossFrame.
1075 return window; 1075 return window;
1076 } 1076 }
1077 return win is _DOMWindowCrossFrame ? win : _blink.Blink_Utils.setInstanceInt erceptor(win, _DOMWindowCrossFrame); 1077 return win is _DOMWindowCrossFrame
1078 ? win
1079 : _blink.Blink_Utils.setInstanceInterceptor(win, _DOMWindowCrossFrame);
1078 } 1080 }
1079 1081
1080 // Fields. 1082 // Fields.
1081 HistoryBase get history { 1083 HistoryBase get history {
1082 var history = _blink.BlinkWindow.instance.history_Getter_(this); 1084 var history = _blink.BlinkWindow.instance.history_Getter_(this);
1083 return history is _HistoryCrossFrame ? history : _blink.Blink_Utils.setInsta nceInterceptor(history, _HistoryCrossFrame); 1085 return history is _HistoryCrossFrame
1086 ? history
1087 : _blink.Blink_Utils
1088 .setInstanceInterceptor(history, _HistoryCrossFrame);
1084 } 1089 }
1085 1090
1086 LocationBase get location { 1091 LocationBase get location {
1087 var location = _blink.BlinkWindow.instance.location_Getter_(this); 1092 var location = _blink.BlinkWindow.instance.location_Getter_(this);
1088 return location is _LocationCrossFrame ? location : _blink.Blink_Utils.setIn stanceInterceptor(location, _LocationCrossFrame); 1093 return location is _LocationCrossFrame
1094 ? location
1095 : _blink.Blink_Utils
1096 .setInstanceInterceptor(location, _LocationCrossFrame);
1089 } 1097 }
1090 1098
1091 bool get closed => _blink.BlinkWindow.instance.closed_Getter_(this); 1099 bool get closed => _blink.BlinkWindow.instance.closed_Getter_(this);
1092 WindowBase get opener => _convertNativeToDart_Window(_blink.BlinkWindow.instan ce.opener_Getter_(this)); 1100 WindowBase get opener => _convertNativeToDart_Window(
1093 WindowBase get parent => _convertNativeToDart_Window(_blink.BlinkWindow.instan ce.parent_Getter_(this)); 1101 _blink.BlinkWindow.instance.opener_Getter_(this));
1094 WindowBase get top => _convertNativeToDart_Window(_blink.BlinkWindow.instance. top_Getter_(this)); 1102 WindowBase get parent => _convertNativeToDart_Window(
1103 _blink.BlinkWindow.instance.parent_Getter_(this));
1104 WindowBase get top => _convertNativeToDart_Window(
1105 _blink.BlinkWindow.instance.top_Getter_(this));
1095 1106
1096 // Methods. 1107 // Methods.
1097 void close() => _blink.BlinkWindow.instance.close_Callback_0_(this); 1108 void close() => _blink.BlinkWindow.instance.close_Callback_0_(this);
1098 void postMessage(Object message, String targetOrigin, [List<MessagePort> trans fer]) => _blink.BlinkWindow.instance.postMessage_Callback_3_(this, convertDartTo Native_SerializedScriptValue(message), targetOrigin, transfer); 1109 void postMessage(Object message, String targetOrigin,
1110 [List<MessagePort> transfer]) =>
1111 _blink.BlinkWindow.instance.postMessage_Callback_3_(
1112 this,
1113 convertDartToNative_SerializedScriptValue(message),
1114 targetOrigin,
1115 transfer);
1099 1116
1100 // Implementation support. 1117 // Implementation support.
1101 String get typeName => "Window"; 1118 String get typeName => "Window";
1102 1119
1103 // TODO(efortuna): Remove this method. dartbug.com/16814 1120 // TODO(efortuna): Remove this method. dartbug.com/16814
1104 Events get on => throw new UnsupportedError( 1121 Events get on => throw new UnsupportedError(
1105 'You can only attach EventListeners to your own window.'); 1122 'You can only attach EventListeners to your own window.');
1106 // TODO(efortuna): Remove this method. dartbug.com/16814 1123 // TODO(efortuna): Remove this method. dartbug.com/16814
1107 void _addEventListener( 1124 void _addEventListener(
1108 [String type, EventListener listener, bool useCapture]) => 1125 [String type, EventListener listener, bool useCapture]) =>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 } 1161 }
1145 1162
1146 // Implementation support. 1163 // Implementation support.
1147 String get typeName => "History"; 1164 String get typeName => "History";
1148 } 1165 }
1149 1166
1150 class _LocationCrossFrame extends DartHtmlDomObject implements LocationBase { 1167 class _LocationCrossFrame extends DartHtmlDomObject implements LocationBase {
1151 _LocationCrossFrame.internal(); 1168 _LocationCrossFrame.internal();
1152 1169
1153 // Fields. 1170 // Fields.
1154 set href(String value) => _blink.BlinkLocation.instance.href_Setter_(this, val ue); 1171 set href(String value) =>
1172 _blink.BlinkLocation.instance.href_Setter_(this, value);
1155 1173
1156 // Implementation support. 1174 // Implementation support.
1157 String get typeName => "Location"; 1175 String get typeName => "Location";
1158 } 1176 }
1159 1177
1160 // TODO(vsm): Remove DOM isolate code once we have Dartium isolates 1178 // TODO(vsm): Remove DOM isolate code once we have Dartium isolates
1161 // as workers. This is only used to support 1179 // as workers. This is only used to support
1162 // printing and timers in background isolates. As workers they should 1180 // printing and timers in background isolates. As workers they should
1163 // be able to just do those things natively. 1181 // be able to just do those things natively.
1164 1182
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 port.listen((args) { 1232 port.listen((args) {
1215 var msg = args.first; 1233 var msg = args.first;
1216 var replyTo = args.last; 1234 var replyTo = args.last;
1217 final cmd = msg[0]; 1235 final cmd = msg[0];
1218 if (cmd == _NEW_TIMER) { 1236 if (cmd == _NEW_TIMER) {
1219 final duration = new Duration(milliseconds: msg[1]); 1237 final duration = new Duration(milliseconds: msg[1]);
1220 bool periodic = msg[2]; 1238 bool periodic = msg[2];
1221 ping() { 1239 ping() {
1222 replyTo.send(_TIMER_PING); 1240 replyTo.send(_TIMER_PING);
1223 } 1241 }
1242
1224 ; 1243 ;
1225 _TIMER_REGISTRY[replyTo] = periodic 1244 _TIMER_REGISTRY[replyTo] = periodic
1226 ? new Timer.periodic(duration, (_) { 1245 ? new Timer.periodic(duration, (_) {
1227 ping(); 1246 ping();
1228 }) 1247 })
1229 : new Timer(duration, ping); 1248 : new Timer(duration, ping);
1230 } else if (cmd == _CANCEL_TIMER) { 1249 } else if (cmd == _CANCEL_TIMER) {
1231 _TIMER_REGISTRY.remove(replyTo).cancel(); 1250 _TIMER_REGISTRY.remove(replyTo).cancel();
1232 } else if (cmd == _PRINT) { 1251 } else if (cmd == _PRINT) {
1233 final message = msg[1]; 1252 final message = msg[1];
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 get _scheduleImmediateClosure => (void callback()) { 1390 get _scheduleImmediateClosure => (void callback()) {
1372 _scheduleImmediateHelper._schedule(callback); 1391 _scheduleImmediateHelper._schedule(callback);
1373 }; 1392 };
1374 1393
1375 get _pureIsolateScheduleImmediateClosure => ((void callback()) => 1394 get _pureIsolateScheduleImmediateClosure => ((void callback()) =>
1376 throw new UnimplementedError("scheduleMicrotask in background isolates " 1395 throw new UnimplementedError("scheduleMicrotask in background isolates "
1377 "are not supported in the browser")); 1396 "are not supported in the browser"));
1378 1397
1379 // Class for unsupported native browser 'DOM' objects. 1398 // Class for unsupported native browser 'DOM' objects.
1380 class _UnsupportedBrowserObject extends DartHtmlDomObject {} 1399 class _UnsupportedBrowserObject extends DartHtmlDomObject {}
OLDNEW
« no previous file with comments | « tools/dom/src/dartium_WrappedEvent.dart ('k') | tools/dom/src/shared_SVGFactoryProviders.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698