| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 """Generates sdk/lib/_blink/dartium/_blink_dartium.dart file.""" | 7 """Generates sdk/lib/_blink/dartium/_blink_dartium.dart file.""" |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 from sets import Set | 10 from sets import Set |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 * for details. All rights reserved. Use of this source code is governed by a | 91 * for details. All rights reserved. Use of this source code is governed by a |
| 92 * BSD-style license that can be found in the LICENSE file. | 92 * BSD-style license that can be found in the LICENSE file. |
| 93 * | 93 * |
| 94 * DO NOT EDIT | 94 * DO NOT EDIT |
| 95 * Auto-generated _blink library. | 95 * Auto-generated _blink library. |
| 96 */ | 96 */ |
| 97 library dart.dom._blink; | 97 library dart.dom._blink; |
| 98 | 98 |
| 99 import 'dart:js' as js; | 99 import 'dart:js' as js; |
| 100 import 'dart:html' show DomException; | 100 import 'dart:html' show DomException; |
| 101 import 'dart:_internal' as internal; |
| 101 // This is a place to put custom renames if we need them. | 102 // This is a place to put custom renames if we need them. |
| 102 final resolverMap = { | 103 final resolverMap = { |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 dynamic resolver(String s) { | 106 dynamic resolver(String s) { |
| 106 """ | 107 """ |
| 107 | 108 |
| 108 END_RESOLVER = """ | 109 END_RESOLVER = """ |
| 109 // Failed to find it, check for custom renames | 110 // Failed to find it, check for custom renames |
| 110 dynamic obj = resolverMap[s]; | 111 dynamic obj = resolverMap[s]; |
| 111 if (obj != null) return obj; | 112 if (obj != null) return obj; |
| 112 throw("No such interface exposed in blink: ${s}"); | 113 throw("No such interface exposed in blink: ${s}"); |
| 113 } | 114 } |
| 114 | 115 |
| 115 """ | 116 """ |
| 116 | 117 |
| 117 BLINK_UTILS = """ | 118 BLINK_UTILS = """ |
| 118 // _Utils native entry points | 119 // _Utils native entry points |
| 119 class Blink_Utils { | 120 class Blink_Utils { |
| 120 static window() native "Utils_window"; | 121 static window() native "Utils_window"; |
| 121 | 122 |
| 122 static forwardingPrint(message) native "Utils_forwardingPrint"; | 123 static forwardingPrint(message) native "Utils_forwardingPrint"; |
| 123 | 124 |
| 124 static spawnDomUri(uri) native "Utils_spawnDomUri"; | 125 static spawnDomUri(uri) native "Utils_spawnDomUri"; |
| 125 | 126 |
| 126 static void spawnDomHelper(Function f, int replyTo) native "Utils_spawnDomHelp
er"; | 127 static void spawnDomHelper(Function f, int replyTo) native "Utils_spawnDomHelp
er"; |
| 127 | 128 |
| 128 static register(document, tag, customType, extendsTagName) native "Utils_regis
ter"; | 129 static register(document, tag, customType, extendsTagName) native "Utils_regis
ter"; |
| 129 | 130 |
| 131 // Below code sets up VMLibraryHooks for resolvePackageUri. |
| 132 static Uri resolvePackageUri(Uri packageUri) native "Utils_resolvePackageUri"; |
| 133 static void _setupHooks() { |
| 134 internal.VMLibraryHooks.resolvePackageUriFuture = resolvePackageUri; |
| 135 } |
| 136 |
| 130 // Defines an interceptor if there is an appropriate JavaScript prototype to d
efine it on. | 137 // Defines an interceptor if there is an appropriate JavaScript prototype to d
efine it on. |
| 131 // In any case, returns a typed JS wrapper compatibile with dart:html and the
new | 138 // In any case, returns a typed JS wrapper compatibile with dart:html and the
new |
| 132 // typed JS Interop. | 139 // typed JS Interop. |
| 133 static defineInterceptorCustomElement(jsObject, Type type) native "Utils_defin
eInterceptorCustomElement"; | 140 static defineInterceptorCustomElement(jsObject, Type type) native "Utils_defin
eInterceptorCustomElement"; |
| 134 static defineInterceptor(jsObject, Type type) native "Utils_defineInterceptor"
; | 141 static defineInterceptor(jsObject, Type type) native "Utils_defineInterceptor"
; |
| 135 static setInstanceInterceptor(o, Type type, {bool customElement: false}) nativ
e "Utils_setInstanceInterceptor"; | 142 static setInstanceInterceptor(o, Type type, {bool customElement: false}) nativ
e "Utils_setInstanceInterceptor"; |
| 136 static setInstanceInterceptorCustomUpgrade(o) native "Utils_setInstanceInterce
ptorCustomUpgrade"; | 143 static setInstanceInterceptorCustomUpgrade(o) native "Utils_setInstanceInterce
ptorCustomUpgrade"; |
| 137 | 144 |
| 138 // This method will throw if the element isn't actually a real Element. | 145 // This method will throw if the element isn't actually a real Element. |
| 139 static initializeCustomElement(element) native "Utils_initializeCustomElement"
; | 146 static initializeCustomElement(element) native "Utils_initializeCustomElement"
; |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 else: | 532 else: |
| 526 arguments = [] | 533 arguments = [] |
| 527 for i in range(0, callback_index): | 534 for i in range(0, callback_index): |
| 528 arguments.append(ARGUMENT_NUM % i) | 535 arguments.append(ARGUMENT_NUM % i) |
| 529 argument_list = ', '.join(arguments) | 536 argument_list = ', '.join(arguments) |
| 530 if operation.is_static: | 537 if operation.is_static: |
| 531 class_property = CLASS_STATIC % interface.id | 538 class_property = CLASS_STATIC % interface.id |
| 532 blink_file.write(Select_Stub(STATIC_OPERATION_ARGS, is_native) % (name,
callback_index, argument_list, class_property, interface.id, name, argument_list
)) | 539 blink_file.write(Select_Stub(STATIC_OPERATION_ARGS, is_native) % (name,
callback_index, argument_list, class_property, interface.id, name, argument_list
)) |
| 533 else: | 540 else: |
| 534 blink_file.write(Select_Stub(OPERATION_ARGS, is_native) % (name, callbac
k_index, argument_list, interface.id, name, argument_list)) | 541 blink_file.write(Select_Stub(OPERATION_ARGS, is_native) % (name, callbac
k_index, argument_list, interface.id, name, argument_list)) |
| OLD | NEW |