| // mojo/public/cpp/bindings/tests/interface_unittest.test-mojom.m.js is auto generated by mojom_bindings_generator.py, do not edit |
| |
| // Copyright 2020 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import {mojo} from '../../../js/bindings.js'; |
| |
| |
| |
| |
| /** |
| * @implements {mojo.internal.interfaceSupport.PendingReceiver} |
| */ |
| export class VeryCoolInterfacePendingReceiver { |
| /** |
| * @param {!MojoHandle|!mojo.internal.interfaceSupport.Endpoint} handle |
| */ |
| constructor(handle) { |
| /** @public {!mojo.internal.interfaceSupport.Endpoint} */ |
| this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle); |
| } |
| |
| /** @param {string=} scope */ |
| bindInBrowser(scope = 'context') { |
| mojo.internal.interfaceSupport.bind( |
| this.handle, 'mojo.test.interface_unittest.mojom.VeryCoolInterface', scope); |
| } |
| } |
| |
| /** @interface */ |
| export class VeryCoolInterfaceInterface { |
| |
| /** |
| */ |
| |
| doesNotMatter() {} |
| } |
| |
| /** |
| * @implements { VeryCoolInterfaceInterface } |
| */ |
| export class VeryCoolInterfaceRemote { |
| /** @param {MojoHandle|mojo.internal.interfaceSupport.Endpoint=} handle */ |
| constructor(handle = undefined) { |
| /** |
| * @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!VeryCoolInterfacePendingReceiver>} |
| */ |
| this.proxy = |
| new mojo.internal.interfaceSupport.InterfaceRemoteBase( |
| VeryCoolInterfacePendingReceiver, |
| handle); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!VeryCoolInterfacePendingReceiver>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy); |
| |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.proxy.getConnectionErrorEventRouter(); |
| } |
| |
| |
| /** |
| */ |
| |
| doesNotMatter() { |
| this.proxy.sendMessage( |
| 1300967379, |
| VeryCoolInterface_DoesNotMatter_ParamsSpec.$, |
| null, |
| [ |
| ]); |
| } |
| } |
| |
| /** |
| * An object which receives request messages for the VeryCoolInterface |
| * mojom interface. Must be constructed over an object which implements that |
| * interface. |
| */ |
| export class VeryCoolInterfaceReceiver { |
| /** |
| * @param {!VeryCoolInterfaceInterface } impl |
| */ |
| constructor(impl) { |
| /** @private {!mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal<!VeryCoolInterfaceRemote>} */ |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| VeryCoolInterfaceRemote); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!VeryCoolInterfaceRemote>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| |
| this.helper_internal_.registerHandler( |
| 1300967379, |
| VeryCoolInterface_DoesNotMatter_ParamsSpec.$, |
| null, |
| impl.doesNotMatter.bind(impl)); |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter(); |
| } |
| } |
| |
| export class VeryCoolInterface { |
| /** |
| * @return {!string} |
| */ |
| static get $interfaceName() { |
| return "mojo.test.interface_unittest.mojom.VeryCoolInterface"; |
| } |
| |
| /** |
| * Returns a remote for this interface which sends messages to the browser. |
| * The browser must have an interface request binder registered for this |
| * interface and accessible to the calling document's frame. |
| * |
| * @return {!VeryCoolInterfaceRemote} |
| */ |
| static getRemote() { |
| let remote = new VeryCoolInterfaceRemote; |
| remote.$.bindNewPipeAndPassReceiver().bindInBrowser(); |
| return remote; |
| } |
| } |
| |
| |
| /** |
| * An object which receives request messages for the VeryCoolInterface |
| * mojom interface and dispatches them as callbacks. One callback receiver exists |
| * on this object for each message defined in the mojom interface, and each |
| * receiver can have any number of listeners added to it. |
| */ |
| export class VeryCoolInterfaceCallbackRouter { |
| constructor() { |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| VeryCoolInterfaceRemote); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!VeryCoolInterfaceRemote>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| this.router_ = new mojo.internal.interfaceSupport.CallbackRouter; |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.doesNotMatter = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 1300967379, |
| VeryCoolInterface_DoesNotMatter_ParamsSpec.$, |
| null, |
| this.doesNotMatter.createReceiverHandler(false /* expectsResponse */)); |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter(); |
| } |
| |
| /** |
| * @param {number} id An ID returned by a prior call to addListener. |
| * @return {boolean} True iff the identified listener was found and removed. |
| */ |
| removeListener(id) { |
| return this.router_.removeListener(id); |
| } |
| } |
| |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| */ |
| export const VeryCoolInterface_DoesNotMatter_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| |
| |
| |
| mojo.internal.Struct( |
| VeryCoolInterface_DoesNotMatter_ParamsSpec.$, |
| 'VeryCoolInterface_DoesNotMatter_Params', |
| [ |
| ], |
| [[0, 8],]); |
| |
| |
| |
| /** |
| * @record |
| */ |
| export class VeryCoolInterface_DoesNotMatter_Params { |
| constructor() { |
| } |
| } |
| |