// chrome/browser/ui/webui/access_code_cast/access_code_cast.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 { RouteRequestResultCodeSpec as mediaRouter_mojom_RouteRequestResultCodeSpec } from './route_request_result_code.mojom-webui.js';
export const AddSinkResultCodeSpec = { $: mojo.internal.Enum() };
export var AddSinkResultCode;
(function (AddSinkResultCode) {
    AddSinkResultCode[AddSinkResultCode["MIN_VALUE"] = 0] = "MIN_VALUE";
    AddSinkResultCode[AddSinkResultCode["MAX_VALUE"] = 14] = "MAX_VALUE";
    AddSinkResultCode[AddSinkResultCode["UNKNOWN_ERROR"] = 0] = "UNKNOWN_ERROR";
    AddSinkResultCode[AddSinkResultCode["OK"] = 1] = "OK";
    AddSinkResultCode[AddSinkResultCode["AUTH_ERROR"] = 2] = "AUTH_ERROR";
    AddSinkResultCode[AddSinkResultCode["HTTP_RESPONSE_CODE_ERROR"] = 3] = "HTTP_RESPONSE_CODE_ERROR";
    AddSinkResultCode[AddSinkResultCode["RESPONSE_MALFORMED"] = 4] = "RESPONSE_MALFORMED";
    AddSinkResultCode[AddSinkResultCode["EMPTY_RESPONSE"] = 5] = "EMPTY_RESPONSE";
    AddSinkResultCode[AddSinkResultCode["INVALID_ACCESS_CODE"] = 6] = "INVALID_ACCESS_CODE";
    AddSinkResultCode[AddSinkResultCode["ACCESS_CODE_NOT_FOUND"] = 7] = "ACCESS_CODE_NOT_FOUND";
    AddSinkResultCode[AddSinkResultCode["TOO_MANY_REQUESTS"] = 8] = "TOO_MANY_REQUESTS";
    AddSinkResultCode[AddSinkResultCode["SERVICE_NOT_PRESENT"] = 9] = "SERVICE_NOT_PRESENT";
    AddSinkResultCode[AddSinkResultCode["SERVER_ERROR"] = 10] = "SERVER_ERROR";
    AddSinkResultCode[AddSinkResultCode["SINK_CREATION_ERROR"] = 11] = "SINK_CREATION_ERROR";
    AddSinkResultCode[AddSinkResultCode["CHANNEL_OPEN_ERROR"] = 12] = "CHANNEL_OPEN_ERROR";
    AddSinkResultCode[AddSinkResultCode["PROFILE_SYNC_ERROR"] = 13] = "PROFILE_SYNC_ERROR";
    AddSinkResultCode[AddSinkResultCode["INTERNAL_MEDIA_ROUTER_ERROR"] = 14] = "INTERNAL_MEDIA_ROUTER_ERROR";
})(AddSinkResultCode || (AddSinkResultCode = {}));
export const CastDiscoveryMethodSpec = { $: mojo.internal.Enum() };
export var CastDiscoveryMethod;
(function (CastDiscoveryMethod) {
    CastDiscoveryMethod[CastDiscoveryMethod["MIN_VALUE"] = 0] = "MIN_VALUE";
    CastDiscoveryMethod[CastDiscoveryMethod["MAX_VALUE"] = 1] = "MAX_VALUE";
    CastDiscoveryMethod[CastDiscoveryMethod["QR_CODE"] = 0] = "QR_CODE";
    CastDiscoveryMethod[CastDiscoveryMethod["INPUT_ACCESS_CODE"] = 1] = "INPUT_ACCESS_CODE";
})(CastDiscoveryMethod || (CastDiscoveryMethod = {}));
export class PageHandlerFactoryPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'access_code_cast.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(108481000, 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(108481000, PageHandlerFactory_CreatePageHandler_ParamsSpec.$, null, impl.createPageHandler.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandlerFactory {
    static get $interfaceName() {
        return "access_code_cast.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(108481000, 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, 'access_code_cast.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();
    }
    addSink(accessCode, discoveryMethod) {
        return this.proxy.sendMessage(1021481800, PageHandler_AddSink_ParamsSpec.$, PageHandler_AddSink_ResponseParamsSpec.$, [
            accessCode,
            discoveryMethod
        ], false);
    }
    castToSink() {
        return this.proxy.sendMessage(2066630691, PageHandler_CastToSink_ParamsSpec.$, PageHandler_CastToSink_ResponseParamsSpec.$, [], 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(1021481800, PageHandler_AddSink_ParamsSpec.$, PageHandler_AddSink_ResponseParamsSpec.$, impl.addSink.bind(impl), false);
        this.helper_internal_.registerHandler(2066630691, PageHandler_CastToSink_ParamsSpec.$, PageHandler_CastToSink_ResponseParamsSpec.$, impl.castToSink.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class PageHandler {
    static get $interfaceName() {
        return "access_code_cast.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_;
    addSink;
    castToSink;
    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.addSink =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1021481800, PageHandler_AddSink_ParamsSpec.$, PageHandler_AddSink_ResponseParamsSpec.$, this.addSink.createReceiverHandler(true /* expectsResponse */), false);
        this.castToSink =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(2066630691, PageHandler_CastToSink_ParamsSpec.$, PageHandler_CastToSink_ResponseParamsSpec.$, this.castToSink.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 class PagePendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'access_code_cast.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();
    }
}
;
/**
 * 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.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class Page {
    static get $interfaceName() {
        return "access_code_cast.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_;
    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.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_AddSink_ParamsSpec = { $: {} };
export const PageHandler_AddSink_ResponseParamsSpec = { $: {} };
export const PageHandler_CastToSink_ParamsSpec = { $: {} };
export const PageHandler_CastToSink_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_AddSink_ParamsSpec.$, 'PageHandler_AddSink_Params', [
    mojo.internal.StructField('accessCode', 0, 0, mojo.internal.String, null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('discoveryMethod', 8, 0, CastDiscoveryMethodSpec.$, 0, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(PageHandler_AddSink_ResponseParamsSpec.$, 'PageHandler_AddSink_ResponseParams', [
    mojo.internal.StructField('resultCode', 0, 0, AddSinkResultCodeSpec.$, 0, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(PageHandler_CastToSink_ParamsSpec.$, 'PageHandler_CastToSink_Params', [], [[0, 8],]);
mojo.internal.Struct(PageHandler_CastToSink_ResponseParamsSpec.$, 'PageHandler_CastToSink_ResponseParams', [
    mojo.internal.StructField('resultCode', 0, 0, mediaRouter_mojom_RouteRequestResultCodeSpec.$, 0, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
export const browserProxyFactory = new MojoBrowserProxyFactory(PageHandlerRemote, PageCallbackRouter, (remote, receiver) => PageHandlerFactory.getRemote().createPageHandler(remote, receiver));
