blob: 23543beba92a032f79d984b6bb25e4eceeddf8ed [file] [log] [blame]
// 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('device.mojom.Geolocation');
goog.require('device.mojom.Geoposition');
goog.provide('device.mojom.GeolocationContext');
goog.provide('device.mojom.GeolocationContextCallbackRouter');
goog.provide('device.mojom.GeolocationContextInterface');
goog.provide('device.mojom.GeolocationContextProxy');
goog.provide('device.mojom.GeolocationContextRequest');
/** @export */
device.mojom.GeolocationContextRequest = class {
/** @param {!MojoHandle} handle */
constructor(handle) {
/** @public {!MojoHandle} */
this.handle = handle;
}
};
/** @interface */
device.mojom.GeolocationContextInterface = class {
/**
* @param { !device.mojom.GeolocationRequest } request
*/
bindGeolocation(request) {}
/**
* @param { !device.mojom.Geoposition } geoposition
*/
setOverride(geoposition) {}
/**
*/
clearOverride() {}
};
/**
* @export
* @implements { device.mojom.GeolocationContextInterface }
*/
device.mojom.GeolocationContextProxy = class {
/** @param {MojoHandle=} opt_handle */
constructor(opt_handle) {
/**
* @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!device.mojom.GeolocationContextRequest>}
*/
this.proxy =
new mojo.internal.interfaceSupport.InterfaceRemoteBase(
device.mojom.GeolocationContextRequest,
opt_handle);
/**
* @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!device.mojom.GeolocationContextRequest>}
*/
this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
/** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */
this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
}
/**
* @param { !device.mojom.GeolocationRequest } request
*/
bindGeolocation(
request) {
this.proxy.sendMessage(
2028037504,
device.mojom.GeolocationContext_BindGeolocation_ParamsSpec.$,
null,
[
request
]);
}
/**
* @param { !device.mojom.Geoposition } geoposition
*/
setOverride(
geoposition) {
this.proxy.sendMessage(
1114708497,
device.mojom.GeolocationContext_SetOverride_ParamsSpec.$,
null,
[
geoposition
]);
}
/**
*/
clearOverride() {
this.proxy.sendMessage(
1247791360,
device.mojom.GeolocationContext_ClearOverride_ParamsSpec.$,
null,
[
]);
}
};
/**
* An object which receives request messages for the GeolocationContext
* mojom interface. Must be constructed over an object which implements that
* interface.
*
* @export
*/
device.mojom.GeolocationContext = class {
/**
* @param {!device.mojom.GeolocationContextInterface } impl
*/
constructor(impl) {
this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver;
this.receiver_.registerHandler(
2028037504,
device.mojom.GeolocationContext_BindGeolocation_ParamsSpec.$,
null,
impl.bindGeolocation.bind(impl));
this.receiver_.registerHandler(
1114708497,
device.mojom.GeolocationContext_SetOverride_ParamsSpec.$,
null,
impl.setOverride.bind(impl));
this.receiver_.registerHandler(
1247791360,
device.mojom.GeolocationContext_ClearOverride_ParamsSpec.$,
null,
impl.clearOverride.bind(impl));
/** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */
this.onConnectionError = this.receiver_.getConnectionErrorEventRouter();
}
/**
* Binds a new handle to this object. Messages which arrive on the handle will
* be read and dispatched to this object.
*
* @param {!MojoHandle} handle
* @export
*/
bindHandle(handle) {
this.receiver_.bindHandle(handle);
}
/**
* Closes all bindings bound to this target.
*
* @export
*/
closeBindings() {
this.receiver_.closeBindings();
}
/**
* 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 {!device.mojom.GeolocationContextProxy}
* @export
*/
static getProxy() {
let proxy = new device.mojom.GeolocationContextProxy;
Mojo.bindInterface('device.mojom.GeolocationContext',
proxy.$.bindNewPipeAndPassReceiver().handle);
return proxy;
}
/**
* Returns a proxy for this interface which sends messages directly to this
* object. Any number of proxies may be created to the same object.
*
* @return {!device.mojom.GeolocationContextProxy}
* @export
*/
createProxy() {
let proxy = new device.mojom.GeolocationContextProxy;
this.receiver_.bindHandle(proxy.$.bindNewPipeAndPassReceiver().handle);
return proxy;
}
};
/**
* @const {string}
* @export
*/
device.mojom.GeolocationContext.$interfaceName =
'device.mojom.GeolocationContext';
/**
* An object which receives request messages for the GeolocationContext
* 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
*/
device.mojom.GeolocationContextCallbackRouter = class {
constructor() {
this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver;
this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
/**
* @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver}
*/
this.bindGeolocation =
new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(
this.router_);
this.receiver_.registerHandler(
2028037504,
device.mojom.GeolocationContext_BindGeolocation_ParamsSpec.$,
null,
this.bindGeolocation.createReceiverHandler(false /* expectsResponse */));
/**
* @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver}
*/
this.setOverride =
new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(
this.router_);
this.receiver_.registerHandler(
1114708497,
device.mojom.GeolocationContext_SetOverride_ParamsSpec.$,
null,
this.setOverride.createReceiverHandler(false /* expectsResponse */));
/**
* @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver}
*/
this.clearOverride =
new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(
this.router_);
this.receiver_.registerHandler(
1247791360,
device.mojom.GeolocationContext_ClearOverride_ParamsSpec.$,
null,
this.clearOverride.createReceiverHandler(false /* expectsResponse */));
/** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */
this.onConnectionError = this.receiver_.getConnectionErrorEventRouter();
}
/**
* Binds a new handle to this object. Messages which arrive on the handle will
* be read and dispatched as callbacks on this object.
*
* @param {!MojoHandle} handle
* @export
*/
bindHandle(handle) {
this.receiver_.bindHandle(handle);
}
/**
* Closes all bindings bound to this receiver. The receiver will not receive any
* further message message events unless rebound to one or more handles.
*/
closeBindings() {
this.receiver_.closeBindings();
}
/**
* Returns a proxy for this interface which sends messages directly to this
* object. Any number of proxies may be created to the same object.
*
* @return {!device.mojom.GeolocationContextProxy}
* @export
*/
createProxy() {
let proxy = new device.mojom.GeolocationContextProxy;
this.receiver_.bindHandle(proxy.$.bindNewPipeAndPassReceiver().handle);
return proxy;
}
/**
* @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('device.mojom.GeolocationContext_BindGeolocation_ParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
device.mojom.GeolocationContext_BindGeolocation_ParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
goog.provide('device.mojom.GeolocationContext_SetOverride_ParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
device.mojom.GeolocationContext_SetOverride_ParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
goog.provide('device.mojom.GeolocationContext_ClearOverride_ParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
device.mojom.GeolocationContext_ClearOverride_ParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
mojo.internal.Struct(
device.mojom.GeolocationContext_BindGeolocation_ParamsSpec.$,
'GeolocationContext_BindGeolocation_Params',
8,
[
mojo.internal.StructField(
'request', 0,
0,
mojo.internal.InterfaceRequest(device.mojom.GeolocationRequest),
null,
false /* nullable */),
]);
goog.provide('device.mojom.GeolocationContext_BindGeolocation_Params');
/**
* @typedef { {
* request: !device.mojom.GeolocationRequest,
* } }
*/
device.mojom.GeolocationContext_BindGeolocation_Params;
mojo.internal.Struct(
device.mojom.GeolocationContext_SetOverride_ParamsSpec.$,
'GeolocationContext_SetOverride_Params',
8,
[
mojo.internal.StructField(
'geoposition', 0,
0,
device.mojom.GeopositionSpec.$,
null,
false /* nullable */),
]);
goog.provide('device.mojom.GeolocationContext_SetOverride_Params');
/**
* @typedef { {
* geoposition: !device.mojom.Geoposition,
* } }
*/
device.mojom.GeolocationContext_SetOverride_Params;
mojo.internal.Struct(
device.mojom.GeolocationContext_ClearOverride_ParamsSpec.$,
'GeolocationContext_ClearOverride_Params',
0,
[
]);
goog.provide('device.mojom.GeolocationContext_ClearOverride_Params');
/** @typedef {Object} */
device.mojom.GeolocationContext_ClearOverride_Params;