| // 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('contextualSearch.mojom.OverlayPosition'); |
| goog.provide('contextualSearch.mojom.OverlayPositionSpec'); |
| /** |
| * @const { {$: !mojo.internal.MojomType} } |
| * @export |
| */ |
| contextualSearch.mojom.OverlayPositionSpec = { $: mojo.internal.Enum() }; |
| |
| /** |
| * @enum {number} |
| * @export |
| */ |
| contextualSearch.mojom.OverlayPosition = { |
| |
| kClose: 0, |
| kPeek: 0, |
| kExpand: 0, |
| kMaximize: 0, |
| MIN_VALUE: 0, |
| MAX_VALUE: 3, |
| }; |
| |
| /** @suppress {checkTypes} */ |
| contextualSearch.mojom.OverlayPosition.kClose = 0; |
| |
| /** @suppress {checkTypes} */ |
| contextualSearch.mojom.OverlayPosition.kPeek = contextualSearch.mojom.OverlayPosition.kClose + 1; |
| |
| /** @suppress {checkTypes} */ |
| contextualSearch.mojom.OverlayPosition.kExpand = contextualSearch.mojom.OverlayPosition.kPeek + 1; |
| |
| /** @suppress {checkTypes} */ |
| contextualSearch.mojom.OverlayPosition.kMaximize = contextualSearch.mojom.OverlayPosition.kExpand + 1; |
| |
| |
| |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService'); |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiServiceCallbackRouter'); |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiServiceInterface'); |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiServiceProxy'); |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiServiceRequest'); |
| |
| |
| /** @export */ |
| contextualSearch.mojom.ContextualSearchJsApiServiceRequest = class { |
| /** @param {!MojoHandle} handle */ |
| constructor(handle) { |
| /** @public {!MojoHandle} */ |
| this.handle = handle; |
| } |
| }; |
| |
| /** @interface */ |
| contextualSearch.mojom.ContextualSearchJsApiServiceInterface = class { |
| |
| /** |
| * @param { !url.mojom.Url } url |
| * @return {Promise<{ |
| shouldEnable: !boolean, |
| * }>} |
| */ |
| |
| shouldEnableJsApi(url) {} |
| |
| /** |
| * @param { !string } message |
| * @param { !boolean } doesAnswer |
| */ |
| |
| handleSetCaption(message, doesAnswer) {} |
| |
| /** |
| * @param { !contextualSearch.mojom.OverlayPosition } desiredPosition |
| */ |
| |
| handleChangeOverlayPosition(desiredPosition) {} |
| }; |
| |
| /** |
| * @export |
| * @implements { contextualSearch.mojom.ContextualSearchJsApiServiceInterface } |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiServiceProxy = class { |
| /** @param {MojoHandle=} opt_handle */ |
| constructor(opt_handle) { |
| /** |
| * @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!contextualSearch.mojom.ContextualSearchJsApiServiceRequest>} |
| */ |
| this.proxy = |
| new mojo.internal.interfaceSupport.InterfaceRemoteBase( |
| contextualSearch.mojom.ContextualSearchJsApiServiceRequest, |
| opt_handle); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!contextualSearch.mojom.ContextualSearchJsApiServiceRequest>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy); |
| |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.proxy.getConnectionErrorEventRouter(); |
| } |
| |
| |
| /** |
| * @param { !url.mojom.Url } url |
| * @return {Promise<{ |
| shouldEnable: !boolean, |
| * }>} |
| */ |
| |
| shouldEnableJsApi( |
| url) { |
| return this.proxy.sendMessage( |
| 1157333606, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec.$, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec.$, |
| [ |
| url |
| ]); |
| } |
| |
| |
| /** |
| * @param { !string } message |
| * @param { !boolean } doesAnswer |
| */ |
| |
| handleSetCaption( |
| message, |
| doesAnswer) { |
| this.proxy.sendMessage( |
| 515988149, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec.$, |
| null, |
| [ |
| message, |
| doesAnswer |
| ]); |
| } |
| |
| |
| /** |
| * @param { !contextualSearch.mojom.OverlayPosition } desiredPosition |
| */ |
| |
| handleChangeOverlayPosition( |
| desiredPosition) { |
| this.proxy.sendMessage( |
| 408732126, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec.$, |
| null, |
| [ |
| desiredPosition |
| ]); |
| } |
| }; |
| |
| /** |
| * An object which receives request messages for the ContextualSearchJsApiService |
| * mojom interface. Must be constructed over an object which implements that |
| * interface. |
| * |
| * @export |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiService = class { |
| /** |
| * @param {!contextualSearch.mojom.ContextualSearchJsApiServiceInterface } impl |
| */ |
| constructor(impl) { |
| /** @private {!mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal<!contextualSearch.mojom.ContextualSearchJsApiServiceProxy>} */ |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| contextualSearch.mojom.ContextualSearchJsApiServiceProxy); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!contextualSearch.mojom.ContextualSearchJsApiServiceProxy>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| |
| this.helper_internal_.registerHandler( |
| 1157333606, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec.$, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec.$, |
| impl.shouldEnableJsApi.bind(impl)); |
| this.helper_internal_.registerHandler( |
| 515988149, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec.$, |
| null, |
| impl.handleSetCaption.bind(impl)); |
| this.helper_internal_.registerHandler( |
| 408732126, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec.$, |
| null, |
| impl.handleChangeOverlayPosition.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 {!contextualSearch.mojom.ContextualSearchJsApiServiceProxy} |
| * @export |
| */ |
| static getProxy() { |
| let proxy = new contextualSearch.mojom.ContextualSearchJsApiServiceProxy; |
| Mojo.bindInterface('contextual_search.mojom.ContextualSearchJsApiService', |
| proxy.$.bindNewPipeAndPassReceiver().handle); |
| return proxy; |
| } |
| |
| /** |
| * @return {!string} |
| */ |
| static get $interfaceName() { |
| return "contextual_search.mojom.ContextualSearchJsApiService"; |
| } |
| |
| }; |
| |
| |
| |
| |
| /** |
| * An object which receives request messages for the ContextualSearchJsApiService |
| * 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 |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiServiceCallbackRouter = class { |
| constructor() { |
| this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal( |
| contextualSearch.mojom.ContextualSearchJsApiServiceProxy); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceReceiverHelper<!contextualSearch.mojom.ContextualSearchJsApiServiceProxy>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_); |
| |
| this.router_ = new mojo.internal.interfaceSupport.CallbackRouter; |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.shouldEnableJsApi = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 1157333606, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec.$, |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec.$, |
| this.shouldEnableJsApi.createReceiverHandler(true /* expectsResponse */)); |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.handleSetCaption = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 515988149, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec.$, |
| null, |
| this.handleSetCaption.createReceiverHandler(false /* expectsResponse */)); |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.handleChangeOverlayPosition = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.helper_internal_.registerHandler( |
| 408732126, |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec.$, |
| null, |
| this.handleChangeOverlayPosition.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. |
| * @export |
| */ |
| removeListener(id) { |
| return this.router_.removeListener(id); |
| } |
| }; |
| |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| |
| |
| |
| mojo.internal.Struct( |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ParamsSpec.$, |
| 'ContextualSearchJsApiService_ShouldEnableJsApi_Params', |
| 8, |
| [ |
| mojo.internal.StructField( |
| 'url', 0, |
| 0, |
| url.mojom.UrlSpec.$, |
| null, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * url: !url.mojom.Url, |
| * } } |
| */ |
| |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_Params; |
| |
| |
| |
| mojo.internal.Struct( |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParamsSpec.$, |
| 'ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParams', |
| 8, |
| [ |
| mojo.internal.StructField( |
| 'shouldEnable', 0, |
| 0, |
| mojo.internal.Bool, |
| false, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParams'); |
| |
| |
| /** |
| * @typedef { { |
| * shouldEnable: !boolean, |
| * } } |
| */ |
| |
| contextualSearch.mojom.ContextualSearchJsApiService_ShouldEnableJsApi_ResponseParams; |
| |
| |
| |
| mojo.internal.Struct( |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_ParamsSpec.$, |
| 'ContextualSearchJsApiService_HandleSetCaption_Params', |
| 16, |
| [ |
| mojo.internal.StructField( |
| 'message', 0, |
| 0, |
| mojo.internal.String, |
| null, |
| false /* nullable */), |
| mojo.internal.StructField( |
| 'doesAnswer', 8, |
| 0, |
| mojo.internal.Bool, |
| false, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * message: !string, |
| * doesAnswer: !boolean, |
| * } } |
| */ |
| |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleSetCaption_Params; |
| |
| |
| |
| mojo.internal.Struct( |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_ParamsSpec.$, |
| 'ContextualSearchJsApiService_HandleChangeOverlayPosition_Params', |
| 8, |
| [ |
| mojo.internal.StructField( |
| 'desiredPosition', 0, |
| 0, |
| contextualSearch.mojom.OverlayPositionSpec.$, |
| 0, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * desiredPosition: !contextualSearch.mojom.OverlayPosition, |
| * } } |
| */ |
| |
| contextualSearch.mojom.ContextualSearchJsApiService_HandleChangeOverlayPosition_Params; |
| |