// components/browser_apis/tab_drag/tab_drag_api.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 { NodeIdSpec as tabsApi_mojom_NodeIdSpec } from './tab_strip_api_types.mojom-webui.js';
import { EmptySpec as mojoBase_mojom_EmptySpec } from '//resources/mojo/mojo/public/mojom/base/empty.mojom-webui.js';
import { ErrorSpec as mojoBase_mojom_ErrorSpec } from '//resources/mojo/mojo/public/mojom/base/error.mojom-webui.js';
import { PointSpec as gfx_mojom_PointSpec, RectSpec as gfx_mojom_RectSpec } from '//resources/mojo/ui/gfx/geometry/mojom/geometry.mojom-webui.js';
export class TabDragServicePendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'tabs_api.mojom.TabDragService', scope);
    }
}
export class TabDragServiceRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(TabDragServicePendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    startDrag(nodeIds, startPoint) {
        return this.proxy.sendMessage(16259203, TabDragService_StartDrag_ParamsSpec.$, TabDragService_StartDrag_ResponseParamsSpec.$, [
            nodeIds,
            startPoint
        ], true);
    }
    registerDropTarget(target, registration) {
        return this.proxy.sendMessage(1217929707, TabDragService_RegisterDropTarget_ParamsSpec.$, TabDragService_RegisterDropTarget_ResponseParamsSpec.$, [
            target,
            registration
        ], true);
    }
}
;
/**
 * An object which receives request messages for the TabDragService
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class TabDragServiceReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(TabDragServiceRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(16259203, TabDragService_StartDrag_ParamsSpec.$, TabDragService_StartDrag_ResponseParamsSpec.$, impl.startDrag.bind(impl), true);
        this.helper_internal_.registerHandler(1217929707, TabDragService_RegisterDropTarget_ParamsSpec.$, TabDragService_RegisterDropTarget_ResponseParamsSpec.$, impl.registerDropTarget.bind(impl), true);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class TabDragService {
    static get $interfaceName() {
        return "tabs_api.mojom.TabDragService";
    }
    /**
     * 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 TabDragServiceRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the TabDragService
 * 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 TabDragServiceCallbackRouter {
    helper_internal_;
    $;
    router_;
    startDrag;
    registerDropTarget;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(TabDragServiceRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.startDrag =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(16259203, TabDragService_StartDrag_ParamsSpec.$, TabDragService_StartDrag_ResponseParamsSpec.$, this.startDrag.createReceiverHandler(true /* expectsResponse */), true);
        this.registerDropTarget =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1217929707, TabDragService_RegisterDropTarget_ParamsSpec.$, TabDragService_RegisterDropTarget_ResponseParamsSpec.$, this.registerDropTarget.createReceiverHandler(true /* expectsResponse */), true);
        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 DropTargetRegistrationPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'tabs_api.mojom.DropTargetRegistration', scope);
    }
}
export class DropTargetRegistrationRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(DropTargetRegistrationPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    onBoundsChanged(bounds) {
        this.proxy.sendMessage(1894530429, DropTargetRegistration_OnBoundsChanged_ParamsSpec.$, null, [
            bounds
        ], false);
    }
}
;
/**
 * An object which receives request messages for the DropTargetRegistration
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class DropTargetRegistrationReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(DropTargetRegistrationRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(1894530429, DropTargetRegistration_OnBoundsChanged_ParamsSpec.$, null, impl.onBoundsChanged.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class DropTargetRegistration {
    static get $interfaceName() {
        return "tabs_api.mojom.DropTargetRegistration";
    }
    /**
     * 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 DropTargetRegistrationRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the DropTargetRegistration
 * 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 DropTargetRegistrationCallbackRouter {
    helper_internal_;
    $;
    router_;
    onBoundsChanged;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(DropTargetRegistrationRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.onBoundsChanged =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1894530429, DropTargetRegistration_OnBoundsChanged_ParamsSpec.$, null, this.onBoundsChanged.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 DropTargetPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'tabs_api.mojom.DropTarget', scope);
    }
}
export class DropTargetRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(DropTargetPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    onDragEntered(sourceTabIds, localPoint) {
        this.proxy.sendMessage(891564940, DropTarget_OnDragEntered_ParamsSpec.$, null, [
            sourceTabIds,
            localPoint
        ], false);
    }
    onDrag(localPoint) {
        this.proxy.sendMessage(269913170, DropTarget_OnDrag_ParamsSpec.$, null, [
            localPoint
        ], false);
    }
    onDragLeave() {
        this.proxy.sendMessage(78256452, DropTarget_OnDragLeave_ParamsSpec.$, null, [], false);
    }
    onDrop(sourceTabIds, localPoint) {
        this.proxy.sendMessage(1791023203, DropTarget_OnDrop_ParamsSpec.$, null, [
            sourceTabIds,
            localPoint
        ], false);
    }
    onDragCancelled() {
        this.proxy.sendMessage(1650437230, DropTarget_OnDragCancelled_ParamsSpec.$, null, [], false);
    }
}
;
/**
 * An object which receives request messages for the DropTarget
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class DropTargetReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(DropTargetRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(891564940, DropTarget_OnDragEntered_ParamsSpec.$, null, impl.onDragEntered.bind(impl), false);
        this.helper_internal_.registerHandler(269913170, DropTarget_OnDrag_ParamsSpec.$, null, impl.onDrag.bind(impl), false);
        this.helper_internal_.registerHandler(78256452, DropTarget_OnDragLeave_ParamsSpec.$, null, impl.onDragLeave.bind(impl), false);
        this.helper_internal_.registerHandler(1791023203, DropTarget_OnDrop_ParamsSpec.$, null, impl.onDrop.bind(impl), false);
        this.helper_internal_.registerHandler(1650437230, DropTarget_OnDragCancelled_ParamsSpec.$, null, impl.onDragCancelled.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class DropTarget {
    static get $interfaceName() {
        return "tabs_api.mojom.DropTarget";
    }
    /**
     * 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 DropTargetRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the DropTarget
 * 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 DropTargetCallbackRouter {
    helper_internal_;
    $;
    router_;
    onDragEntered;
    onDrag;
    onDragLeave;
    onDrop;
    onDragCancelled;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(DropTargetRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.onDragEntered =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(891564940, DropTarget_OnDragEntered_ParamsSpec.$, null, this.onDragEntered.createReceiverHandler(false /* expectsResponse */), false);
        this.onDrag =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(269913170, DropTarget_OnDrag_ParamsSpec.$, null, this.onDrag.createReceiverHandler(false /* expectsResponse */), false);
        this.onDragLeave =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(78256452, DropTarget_OnDragLeave_ParamsSpec.$, null, this.onDragLeave.createReceiverHandler(false /* expectsResponse */), false);
        this.onDrop =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1791023203, DropTarget_OnDrop_ParamsSpec.$, null, this.onDrop.createReceiverHandler(false /* expectsResponse */), false);
        this.onDragCancelled =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1650437230, DropTarget_OnDragCancelled_ParamsSpec.$, null, this.onDragCancelled.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 TabDragService_StartDrag_ParamsSpec = { $: {} };
export const TabDragService_StartDrag_ResponseParamsSpec = { $: {} };
export const TabDragService_RegisterDropTarget_ParamsSpec = { $: {} };
export const TabDragService_RegisterDropTarget_ResponseParamsSpec = { $: {} };
export const DropTargetRegistration_OnBoundsChanged_ParamsSpec = { $: {} };
export const DropTarget_OnDragEntered_ParamsSpec = { $: {} };
export const DropTarget_OnDrag_ParamsSpec = { $: {} };
export const DropTarget_OnDragLeave_ParamsSpec = { $: {} };
export const DropTarget_OnDrop_ParamsSpec = { $: {} };
export const DropTarget_OnDragCancelled_ParamsSpec = { $: {} };
export const TabDragService_StartDrag_ResponseParam_ResultSpec = { $: {} };
export const TabDragService_RegisterDropTarget_ResponseParam_ResultSpec = { $: {} };
mojo.internal.Struct(TabDragService_StartDrag_ParamsSpec.$, 'TabDragService_StartDrag_Params', [
    mojo.internal.StructField('nodeIds', 0, 0, mojo.internal.Array(tabsApi_mojom_NodeIdSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('startPoint', 8, 0, gfx_mojom_PointSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(TabDragService_StartDrag_ResponseParamsSpec.$, 'TabDragService_StartDrag_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, TabDragService_StartDrag_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(TabDragService_RegisterDropTarget_ParamsSpec.$, 'TabDragService_RegisterDropTarget_Params', [
    mojo.internal.StructField('target', 0, 0, mojo.internal.AssociatedInterfaceProxy(DropTargetRemote), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('registration', 8, 0, mojo.internal.AssociatedInterfaceRequest(DropTargetRegistrationPendingReceiver), null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(TabDragService_RegisterDropTarget_ResponseParamsSpec.$, 'TabDragService_RegisterDropTarget_ResponseParams', [
    mojo.internal.StructField('result', 0, 0, TabDragService_RegisterDropTarget_ResponseParam_ResultSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(DropTargetRegistration_OnBoundsChanged_ParamsSpec.$, 'DropTargetRegistration_OnBoundsChanged_Params', [
    mojo.internal.StructField('bounds', 0, 0, gfx_mojom_RectSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(DropTarget_OnDragEntered_ParamsSpec.$, 'DropTarget_OnDragEntered_Params', [
    mojo.internal.StructField('sourceTabIds', 0, 0, mojo.internal.Array(tabsApi_mojom_NodeIdSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('localPoint', 8, 0, gfx_mojom_PointSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(DropTarget_OnDrag_ParamsSpec.$, 'DropTarget_OnDrag_Params', [
    mojo.internal.StructField('localPoint', 0, 0, gfx_mojom_PointSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(DropTarget_OnDragLeave_ParamsSpec.$, 'DropTarget_OnDragLeave_Params', [], [[0, 8],]);
mojo.internal.Struct(DropTarget_OnDrop_ParamsSpec.$, 'DropTarget_OnDrop_Params', [
    mojo.internal.StructField('sourceTabIds', 0, 0, mojo.internal.Array(tabsApi_mojom_NodeIdSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
    mojo.internal.StructField('localPoint', 8, 0, gfx_mojom_PointSpec.$, null, false /* nullable */, 0, undefined, undefined),
], [[0, 24],]);
mojo.internal.Struct(DropTarget_OnDragCancelled_ParamsSpec.$, 'DropTarget_OnDragCancelled_Params', [], [[0, 8],]);
mojo.internal.Union(TabDragService_StartDrag_ResponseParam_ResultSpec.$, 'TabDragService_StartDrag_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': mojoBase_mojom_EmptySpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var TabDragService_StartDrag_ResponseParam_ResultFieldTags;
(function (TabDragService_StartDrag_ResponseParam_ResultFieldTags) {
    TabDragService_StartDrag_ResponseParam_ResultFieldTags[TabDragService_StartDrag_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    TabDragService_StartDrag_ResponseParam_ResultFieldTags[TabDragService_StartDrag_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(TabDragService_StartDrag_ResponseParam_ResultFieldTags || (TabDragService_StartDrag_ResponseParam_ResultFieldTags = {}));
export function whichTabDragService_StartDrag_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return TabDragService_StartDrag_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return TabDragService_StartDrag_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
mojo.internal.Union(TabDragService_RegisterDropTarget_ResponseParam_ResultSpec.$, 'TabDragService_RegisterDropTarget_ResponseParam_Result', {
    'success': {
        'ordinal': 0,
        'type': mojoBase_mojom_EmptySpec.$,
    },
    'failure': {
        'ordinal': 1,
        'type': mojoBase_mojom_ErrorSpec.$,
    },
});
export var TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags;
(function (TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags) {
    TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags[TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags["SUCCESS"] = 0] = "SUCCESS";
    TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags[TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags["FAILURE"] = 1] = "FAILURE";
})(TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags || (TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags = {}));
export function whichTabDragService_RegisterDropTarget_ResponseParam_Result(u) {
    if (u.success !== null && u.success !== undefined) {
        return TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags.SUCCESS;
    }
    if (u.failure !== null && u.failure !== undefined) {
        return TabDragService_RegisterDropTarget_ResponseParam_ResultFieldTags.FAILURE;
    }
    throw new Error("no union field has been set, this is an illegal state");
}
