// chrome/browser/ui/webui/omnibox_popup/mojom/omnibox_popup_aim.mojom-webui.ts is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { mojo } from '//resources/mojo/mojo/public/js/bindings.js';
import { MojoBrowserProxyFactory } from '//resources/mojo/mojo_browser_proxy.js';
import { SearchContextSpec as searchbox_mojom_SearchContextSpec } from '//resources/mojo/components/omnibox/browser/searchbox.mojom-webui.js';
import { PointSpec as gfx_mojom_PointSpec } from '//resources/mojo/ui/gfx/geometry/mojom/geometry.mojom-webui.js';
export class PageHandlerFactoryPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'omnibox_popup_aim.mojom.PageHandlerFactory', scope);
    }
}
export class PageHandlerFactoryRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(PageHandlerFactoryPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    createPageHandler(page, handler) {
        this.proxy.sendMessage(1800016980, PageHandlerFactory_CreatePageHandler_ParamsSpec.$, null, [
            page,
            handler
        ], false);
    }
}
;
/**
 * An object which receives request messages for the PageHandlerFactory
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class PageHandlerFactoryReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageHandlerFactoryRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(1800016980, PageHandlerFactory_CreatePageHandler_ParamsSpec.$, null, impl.createPageHandler.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandlerFactory {
    static get $interfaceName() {
        return "omnibox_popup_aim.mojom.PageHandlerFactory";
    }
    /**
     * 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.
     */
    static getRemote() {
        let remote = new PageHandlerFactoryRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the PageHandlerFactory
 * 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 PageHandlerFactoryCallbackRouter {
    helper_internal_;
    $;
    router_;
    createPageHandler;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageHandlerFactoryRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.createPageHandler =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1800016980, PageHandlerFactory_CreatePageHandler_ParamsSpec.$, null, this.createPageHandler.createReceiverHandler(false /* expectsResponse */), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export class PageHandlerPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'omnibox_popup_aim.mojom.PageHandler', scope);
    }
}
export class PageHandlerRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(PageHandlerPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    requestClose() {
        this.proxy.sendMessage(2030115037, PageHandler_RequestClose_ParamsSpec.$, null, [], false);
    }
    showContextMenu(point) {
        this.proxy.sendMessage(1063132457, PageHandler_ShowContextMenu_ParamsSpec.$, null, [
            point
        ], false);
    }
}
;
/**
 * An object which receives request messages for the PageHandler
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class PageHandlerReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageHandlerRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(2030115037, PageHandler_RequestClose_ParamsSpec.$, null, impl.requestClose.bind(impl), false);
        this.helper_internal_.registerHandler(1063132457, PageHandler_ShowContextMenu_ParamsSpec.$, null, impl.showContextMenu.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandler {
    static get $interfaceName() {
        return "omnibox_popup_aim.mojom.PageHandler";
    }
    /**
     * 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.
     */
    static getRemote() {
        let remote = new PageHandlerRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the PageHandler
 * 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 PageHandlerCallbackRouter {
    helper_internal_;
    $;
    router_;
    requestClose;
    showContextMenu;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageHandlerRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.requestClose =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(2030115037, PageHandler_RequestClose_ParamsSpec.$, null, this.requestClose.createReceiverHandler(false /* expectsResponse */), false);
        this.showContextMenu =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1063132457, PageHandler_ShowContextMenu_ParamsSpec.$, null, this.showContextMenu.createReceiverHandler(false /* expectsResponse */), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export class PagePendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'omnibox_popup_aim.mojom.Page', scope);
    }
}
export class PageRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(PagePendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    onPopupShown(context) {
        this.proxy.sendMessage(318221681, Page_OnPopupShown_ParamsSpec.$, null, [
            context
        ], false);
    }
    addContext(context) {
        this.proxy.sendMessage(18012468, Page_AddContext_ParamsSpec.$, null, [
            context
        ], false);
    }
    focusInput() {
        this.proxy.sendMessage(1055893417, Page_FocusInput_ParamsSpec.$, null, [], false);
    }
    clearPopup() {
        return this.proxy.sendMessage(1596756400, Page_ClearPopup_ParamsSpec.$, Page_ClearPopup_ResponseParamsSpec.$, [], false);
    }
    setPreserveContextOnClose(preserveContextOnClose) {
        this.proxy.sendMessage(788722477, Page_SetPreserveContextOnClose_ParamsSpec.$, null, [
            preserveContextOnClose
        ], false);
    }
    onContextMenuClosed() {
        this.proxy.sendMessage(1920398466, Page_OnContextMenuClosed_ParamsSpec.$, null, [], false);
    }
}
;
/**
 * An object which receives request messages for the Page
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class PageReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(318221681, Page_OnPopupShown_ParamsSpec.$, null, impl.onPopupShown.bind(impl), false);
        this.helper_internal_.registerHandler(18012468, Page_AddContext_ParamsSpec.$, null, impl.addContext.bind(impl), false);
        this.helper_internal_.registerHandler(1055893417, Page_FocusInput_ParamsSpec.$, null, impl.focusInput.bind(impl), false);
        this.helper_internal_.registerHandler(1596756400, Page_ClearPopup_ParamsSpec.$, Page_ClearPopup_ResponseParamsSpec.$, impl.clearPopup.bind(impl), false);
        this.helper_internal_.registerHandler(788722477, Page_SetPreserveContextOnClose_ParamsSpec.$, null, impl.setPreserveContextOnClose.bind(impl), false);
        this.helper_internal_.registerHandler(1920398466, Page_OnContextMenuClosed_ParamsSpec.$, null, impl.onContextMenuClosed.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class Page {
    static get $interfaceName() {
        return "omnibox_popup_aim.mojom.Page";
    }
    /**
     * 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.
     */
    static getRemote() {
        let remote = new PageRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the Page
 * 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 PageCallbackRouter {
    helper_internal_;
    $;
    router_;
    onPopupShown;
    addContext;
    focusInput;
    clearPopup;
    setPreserveContextOnClose;
    onContextMenuClosed;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(PageRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.onPopupShown =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(318221681, Page_OnPopupShown_ParamsSpec.$, null, this.onPopupShown.createReceiverHandler(false /* expectsResponse */), false);
        this.addContext =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(18012468, Page_AddContext_ParamsSpec.$, null, this.addContext.createReceiverHandler(false /* expectsResponse */), false);
        this.focusInput =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1055893417, Page_FocusInput_ParamsSpec.$, null, this.focusInput.createReceiverHandler(false /* expectsResponse */), false);
        this.clearPopup =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1596756400, Page_ClearPopup_ParamsSpec.$, Page_ClearPopup_ResponseParamsSpec.$, this.clearPopup.createReceiverHandler(true /* expectsResponse */), false);
        this.setPreserveContextOnClose =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(788722477, Page_SetPreserveContextOnClose_ParamsSpec.$, null, this.setPreserveContextOnClose.createReceiverHandler(false /* expectsResponse */), false);
        this.onContextMenuClosed =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1920398466, Page_OnContextMenuClosed_ParamsSpec.$, null, this.onContextMenuClosed.createReceiverHandler(false /* expectsResponse */), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export const PageHandlerFactory_CreatePageHandler_ParamsSpec = { $: {} };
export const PageHandler_RequestClose_ParamsSpec = { $: {} };
export const PageHandler_ShowContextMenu_ParamsSpec = { $: {} };
export const Page_OnPopupShown_ParamsSpec = { $: {} };
export const Page_AddContext_ParamsSpec = { $: {} };
export const Page_FocusInput_ParamsSpec = { $: {} };
export const Page_ClearPopup_ParamsSpec = { $: {} };
export const Page_ClearPopup_ResponseParamsSpec = { $: {} };
export const Page_SetPreserveContextOnClose_ParamsSpec = { $: {} };
export const Page_OnContextMenuClosed_ParamsSpec = { $: {} };
mojo.internal.Struct(PageHandlerFactory_CreatePageHandler_ParamsSpec.$, 'PageHandlerFactory_CreatePageHandler_Params', [
    mojo.internal.StructField('page', 0, 0, mojo.internal.InterfaceProxy(PageRemote), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('handler', 8, 0, mojo.internal.InterfaceRequest(PageHandlerPendingReceiver), null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(PageHandler_RequestClose_ParamsSpec.$, 'PageHandler_RequestClose_Params', [], [[0, 8],]);
mojo.internal.Struct(PageHandler_ShowContextMenu_ParamsSpec.$, 'PageHandler_ShowContextMenu_Params', [
    mojo.internal.StructField('point', 0, 0, gfx_mojom_PointSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(Page_OnPopupShown_ParamsSpec.$, 'Page_OnPopupShown_Params', [
    mojo.internal.StructField('context', 0, 0, searchbox_mojom_SearchContextSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(Page_AddContext_ParamsSpec.$, 'Page_AddContext_Params', [
    mojo.internal.StructField('context', 0, 0, searchbox_mojom_SearchContextSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(Page_FocusInput_ParamsSpec.$, 'Page_FocusInput_Params', [], [[0, 8],]);
mojo.internal.Struct(Page_ClearPopup_ParamsSpec.$, 'Page_ClearPopup_Params', [], [[0, 8],]);
mojo.internal.Struct(Page_ClearPopup_ResponseParamsSpec.$, 'Page_ClearPopup_ResponseParams', [
    mojo.internal.StructField('input', 0, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(Page_SetPreserveContextOnClose_ParamsSpec.$, 'Page_SetPreserveContextOnClose_Params', [
    mojo.internal.StructField('preserveContextOnClose', 0, 0, mojo.internal.Bool, false, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(Page_OnContextMenuClosed_ParamsSpec.$, 'Page_OnContextMenuClosed_Params', [], [[0, 8],]);
export const browserProxyFactory = new MojoBrowserProxyFactory(PageHandlerRemote, PageCallbackRouter, (remote, receiver) => PageHandlerFactory.getRemote().createPageHandler(remote, receiver));
