// components/browser_apis/ui_controllers/toolbar/extensions_bar.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 { ExtensionActionInfoSpec as extensionsBar_mojom_ExtensionActionInfoSpec } from './extensions_bar_data_model.mojom-webui.js';
import { IconUpdateSpec as toolbarUiApi_mojom_IconUpdateSpec } from './icon_handle.mojom-webui.js';
import { MenuSourceTypeSpec as ui_mojom_MenuSourceTypeSpec } from '//resources/mojo/ui/base/mojom/menu_source_type.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, 'extensions_bar.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(1281047200, 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(1281047200, PageHandlerFactory_CreatePageHandler_ParamsSpec.$, null, impl.createPageHandler.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandlerFactory {
    static get $interfaceName() {
        return "extensions_bar.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(1281047200, 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, 'extensions_bar.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();
    }
    executeUserAction(id) {
        this.proxy.sendMessage(885241339, PageHandler_ExecuteUserAction_ParamsSpec.$, null, [
            id
        ], false);
    }
    showContextMenu(source, id) {
        this.proxy.sendMessage(1018284743, PageHandler_ShowContextMenu_ParamsSpec.$, null, [
            source,
            id
        ], false);
    }
    toggleExtensionsMenuFromWebUI() {
        this.proxy.sendMessage(1609932284, PageHandler_ToggleExtensionsMenuFromWebUI_ParamsSpec.$, null, [], 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(885241339, PageHandler_ExecuteUserAction_ParamsSpec.$, null, impl.executeUserAction.bind(impl), false);
        this.helper_internal_.registerHandler(1018284743, PageHandler_ShowContextMenu_ParamsSpec.$, null, impl.showContextMenu.bind(impl), false);
        this.helper_internal_.registerHandler(1609932284, PageHandler_ToggleExtensionsMenuFromWebUI_ParamsSpec.$, null, impl.toggleExtensionsMenuFromWebUI.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandler {
    static get $interfaceName() {
        return "extensions_bar.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_;
    executeUserAction;
    showContextMenu;
    toggleExtensionsMenuFromWebUI;
    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.executeUserAction =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(885241339, PageHandler_ExecuteUserAction_ParamsSpec.$, null, this.executeUserAction.createReceiverHandler(false /* expectsResponse */), false);
        this.showContextMenu =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1018284743, PageHandler_ShowContextMenu_ParamsSpec.$, null, this.showContextMenu.createReceiverHandler(false /* expectsResponse */), false);
        this.toggleExtensionsMenuFromWebUI =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1609932284, PageHandler_ToggleExtensionsMenuFromWebUI_ParamsSpec.$, null, this.toggleExtensionsMenuFromWebUI.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, 'extensions_bar.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();
    }
    actionsAddedOrUpdated(icons, actions) {
        this.proxy.sendMessage(1230811117, Page_ActionsAddedOrUpdated_ParamsSpec.$, null, [
            icons,
            actions
        ], false);
    }
    actionRemoved(icons, id) {
        this.proxy.sendMessage(1706189929, Page_ActionRemoved_ParamsSpec.$, null, [
            icons,
            id
        ], false);
    }
    actionPoppedOut() {
        return this.proxy.sendMessage(1508102955, Page_ActionPoppedOut_ParamsSpec.$, Page_ActionPoppedOut_ResponseParamsSpec.$, [], 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(1230811117, Page_ActionsAddedOrUpdated_ParamsSpec.$, null, impl.actionsAddedOrUpdated.bind(impl), false);
        this.helper_internal_.registerHandler(1706189929, Page_ActionRemoved_ParamsSpec.$, null, impl.actionRemoved.bind(impl), false);
        this.helper_internal_.registerHandler(1508102955, Page_ActionPoppedOut_ParamsSpec.$, Page_ActionPoppedOut_ResponseParamsSpec.$, impl.actionPoppedOut.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class Page {
    static get $interfaceName() {
        return "extensions_bar.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_;
    actionsAddedOrUpdated;
    actionRemoved;
    actionPoppedOut;
    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.actionsAddedOrUpdated =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1230811117, Page_ActionsAddedOrUpdated_ParamsSpec.$, null, this.actionsAddedOrUpdated.createReceiverHandler(false /* expectsResponse */), false);
        this.actionRemoved =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1706189929, Page_ActionRemoved_ParamsSpec.$, null, this.actionRemoved.createReceiverHandler(false /* expectsResponse */), false);
        this.actionPoppedOut =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1508102955, Page_ActionPoppedOut_ParamsSpec.$, Page_ActionPoppedOut_ResponseParamsSpec.$, this.actionPoppedOut.createReceiverHandler(true /* 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_ExecuteUserAction_ParamsSpec = { $: {} };
export const PageHandler_ShowContextMenu_ParamsSpec = { $: {} };
export const PageHandler_ToggleExtensionsMenuFromWebUI_ParamsSpec = { $: {} };
export const Page_ActionsAddedOrUpdated_ParamsSpec = { $: {} };
export const Page_ActionRemoved_ParamsSpec = { $: {} };
export const Page_ActionPoppedOut_ParamsSpec = { $: {} };
export const Page_ActionPoppedOut_ResponseParamsSpec = { $: {} };
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_ExecuteUserAction_ParamsSpec.$, 'PageHandler_ExecuteUserAction_Params', [
    mojo.internal.StructField('id', 0, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(PageHandler_ShowContextMenu_ParamsSpec.$, 'PageHandler_ShowContextMenu_Params', [
    mojo.internal.StructField('source', 0, 0, ui_mojom_MenuSourceTypeSpec.$, 0, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('id', 8, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(PageHandler_ToggleExtensionsMenuFromWebUI_ParamsSpec.$, 'PageHandler_ToggleExtensionsMenuFromWebUI_Params', [], [[0, 8],]);
mojo.internal.Struct(Page_ActionsAddedOrUpdated_ParamsSpec.$, 'Page_ActionsAddedOrUpdated_Params', [
    mojo.internal.StructField('icons', 0, 0, mojo.internal.Array(toolbarUiApi_mojom_IconUpdateSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('actions', 8, 0, mojo.internal.Array(extensionsBar_mojom_ExtensionActionInfoSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(Page_ActionRemoved_ParamsSpec.$, 'Page_ActionRemoved_Params', [
    mojo.internal.StructField('icons', 0, 0, mojo.internal.Array(toolbarUiApi_mojom_IconUpdateSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('id', 8, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(Page_ActionPoppedOut_ParamsSpec.$, 'Page_ActionPoppedOut_Params', [], [[0, 8],]);
mojo.internal.Struct(Page_ActionPoppedOut_ResponseParamsSpec.$, 'Page_ActionPoppedOut_ResponseParams', [], [[0, 8],]);
export const browserProxyFactory = new MojoBrowserProxyFactory(PageHandlerRemote, PageCallbackRouter, (remote, receiver) => PageHandlerFactory.getRemote().createPageHandler(remote, receiver));
