| // Copyright 2018 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. |
| 'use strict'; |
| |
| goog.require('mojo.internal'); |
| goog.require('mojo.internal.interfaceSupport'); |
| |
| goog.require('url.mojom.Url'); |
| |
| |
| |
| |
| |
| |
| |
| goog.provide('blink.mojom.FrameHostTestInterface'); |
| goog.provide('blink.mojom.FrameHostTestInterfaceCallbackRouter'); |
| goog.provide('blink.mojom.FrameHostTestInterfaceInterface'); |
| goog.provide('blink.mojom.FrameHostTestInterfaceProxy'); |
| goog.provide('blink.mojom.FrameHostTestInterfaceRequest'); |
| |
| |
| /** @export */ |
| blink.mojom.FrameHostTestInterfaceRequest = class { |
| /** @param {!MojoHandle} handle */ |
| constructor(handle) { |
| /** @public {!MojoHandle} */ |
| this.handle = handle; |
| } |
| }; |
| |
| /** @interface */ |
| blink.mojom.FrameHostTestInterfaceInterface = class { |
| |
| /** |
| * @param { !url.mojom.Url } sourceUrl |
| * @param { !string } sourceEvent |
| */ |
| |
| ping(sourceUrl, sourceEvent) {} |
| |
| /** |
| * @return {Promise<{ |
| name: !string, |
| * }>} |
| */ |
| |
| getName() {} |
| }; |
| |
| /** |
| * @export |
| * @implements { blink.mojom.FrameHostTestInterfaceInterface } |
| */ |
| blink.mojom.FrameHostTestInterfaceProxy = class { |
| /** @param {MojoHandle=} opt_handle */ |
| constructor(opt_handle) { |
| /** |
| * @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!blink.mojom.FrameHostTestInterfaceRequest>} |
| */ |
| this.proxy = |
| new mojo.internal.interfaceSupport.InterfaceRemoteBase( |
| blink.mojom.FrameHostTestInterfaceRequest, |
| opt_handle); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!blink.mojom.FrameHostTestInterfaceRequest>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy); |
| |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.proxy.getConnectionErrorEventRouter(); |
| } |
| |
| |
| /** |
| * @param { !url.mojom.Url } sourceUrl |
| * @param { !string } sourceEvent |
| */ |
| |
| ping( |
| sourceUrl, |
| sourceEvent) { |
| this.proxy.sendMessage( |
| 0, |
| blink.mojom.FrameHostTestInterface_Ping_ParamsSpec.$, |
| null, |
| [ |
| sourceUrl, |
| sourceEvent |
| ]); |
| } |
| |
| |
| /** |
| * @return {Promise<{ |
| name: !string, |
| * }>} |
| */ |
| |
| getName() { |
| return this.proxy.sendMessage( |
| 1, |
| blink.mojom.FrameHostTestInterface_GetName_ParamsSpec.$, |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec.$, |
| [ |
| ]); |
| } |
| }; |
| |
| /** |
| * An object which receives request messages for the FrameHostTestInterface |
| * mojom interface. Must be constructed over an object which implements that |
| * interface. |
| * |
| * @export |
| */ |
| blink.mojom.FrameHostTestInterface = class { |
| /** |
| * @param {!blink.mojom.FrameHostTestInterfaceInterface } impl |
| */ |
| constructor(impl) { |
| /** @private {!mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal<!blink.mojom.FrameHostTestInterfaceProxy>} */ |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| blink.mojom.FrameHostTestInterfaceProxy); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!blink.mojom.FrameHostTestInterfaceProxy>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| |
| this.helper_internal_.registerHandler( |
| 0, |
| blink.mojom.FrameHostTestInterface_Ping_ParamsSpec.$, |
| null, |
| impl.ping.bind(impl)); |
| this.helper_internal_.registerHandler( |
| 1, |
| blink.mojom.FrameHostTestInterface_GetName_ParamsSpec.$, |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec.$, |
| impl.getName.bind(impl)); |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter(); |
| } |
| |
| /** |
| * Returns a proxy 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 {!blink.mojom.FrameHostTestInterfaceProxy} |
| * @export |
| */ |
| static getProxy() { |
| let proxy = new blink.mojom.FrameHostTestInterfaceProxy; |
| Mojo.bindInterface('blink.mojom.FrameHostTestInterface', |
| proxy.$.bindNewPipeAndPassReceiver().handle); |
| return proxy; |
| } |
| |
| /** |
| * @return {!string} |
| */ |
| static get $interfaceName() { |
| return "blink.mojom.FrameHostTestInterface"; |
| } |
| |
| }; |
| |
| |
| |
| |
| /** |
| * An object which receives request messages for the FrameHostTestInterface |
| * 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 |
| */ |
| blink.mojom.FrameHostTestInterfaceCallbackRouter = class { |
| constructor() { |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| blink.mojom.FrameHostTestInterfaceProxy); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!blink.mojom.FrameHostTestInterfaceProxy>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| this.router_ = new mojo.internal.interfaceSupport.CallbackRouter; |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.ping = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 0, |
| blink.mojom.FrameHostTestInterface_Ping_ParamsSpec.$, |
| null, |
| this.ping.createReceiverHandler(false /* expectsResponse */)); |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.getName = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 1, |
| blink.mojom.FrameHostTestInterface_GetName_ParamsSpec.$, |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec.$, |
| this.getName.createReceiverHandler(true /* 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. |
| * @export |
| */ |
| removeListener(id) { |
| return this.router_.removeListener(id); |
| } |
| }; |
| |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_Ping_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| blink.mojom.FrameHostTestInterface_Ping_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_GetName_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| blink.mojom.FrameHostTestInterface_GetName_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| |
| |
| |
| mojo.internal.Struct( |
| blink.mojom.FrameHostTestInterface_Ping_ParamsSpec.$, |
| 'FrameHostTestInterface_Ping_Params', |
| 16, |
| [ |
| mojo.internal.StructField( |
| 'sourceUrl', 0, |
| 0, |
| url.mojom.UrlSpec.$, |
| null, |
| false /* nullable */), |
| mojo.internal.StructField( |
| 'sourceEvent', 8, |
| 0, |
| mojo.internal.String, |
| null, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_Ping_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * sourceUrl: !url.mojom.Url, |
| * sourceEvent: !string, |
| * } } |
| */ |
| |
| blink.mojom.FrameHostTestInterface_Ping_Params; |
| |
| |
| |
| mojo.internal.Struct( |
| blink.mojom.FrameHostTestInterface_GetName_ParamsSpec.$, |
| 'FrameHostTestInterface_GetName_Params', |
| 0, |
| [ |
| ]); |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_GetName_Params'); |
| |
| |
| /** @typedef {Object} */ |
| |
| blink.mojom.FrameHostTestInterface_GetName_Params; |
| |
| |
| |
| mojo.internal.Struct( |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParamsSpec.$, |
| 'FrameHostTestInterface_GetName_ResponseParams', |
| 8, |
| [ |
| mojo.internal.StructField( |
| 'name', 0, |
| 0, |
| mojo.internal.String, |
| null, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('blink.mojom.FrameHostTestInterface_GetName_ResponseParams'); |
| |
| |
| /** |
| * @typedef { { |
| * name: !string, |
| * } } |
| */ |
| |
| blink.mojom.FrameHostTestInterface_GetName_ResponseParams; |
| |