blob: 4544e5c48799dcef41419ab000df52b35a87722f [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('blink.mojom.ManifestDebugInfo');
goog.require('url.mojom.Url');
goog.require('blink.mojom.Manifest');
goog.provide('blink.mojom.ManifestManager');
goog.provide('blink.mojom.ManifestManagerCallbackRouter');
goog.provide('blink.mojom.ManifestManagerInterface');
goog.provide('blink.mojom.ManifestManagerProxy');
goog.provide('blink.mojom.ManifestManagerRequest');
/** @export */
blink.mojom.ManifestManagerRequest = class {
/** @param {!MojoHandle} handle */
constructor(handle) {
/** @public {!MojoHandle} */
this.handle = handle;
}
};
/** @interface */
blink.mojom.ManifestManagerInterface = class {
/**
* @return {Promise<{
url: !url.mojom.Url,
manifest: ?blink.mojom.Manifest,
* }>}
*/
requestManifest() {}
/**
* @return {Promise<{
url: !url.mojom.Url,
debugInfo: ?blink.mojom.ManifestDebugInfo,
* }>}
*/
requestManifestDebugInfo() {}
};
/**
* @export
* @implements { blink.mojom.ManifestManagerInterface }
*/
blink.mojom.ManifestManagerProxy = class {
/** @param {MojoHandle=} opt_handle */
constructor(opt_handle) {
/**
* @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!blink.mojom.ManifestManagerRequest>}
*/
this.proxy =
new mojo.internal.interfaceSupport.InterfaceRemoteBase(
blink.mojom.ManifestManagerRequest,
opt_handle);
/**
* @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!blink.mojom.ManifestManagerRequest>}
*/
this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
/** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */
this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
}
/**
* @return {Promise<{
url: !url.mojom.Url,
manifest: ?blink.mojom.Manifest,
* }>}
*/
requestManifest() {
return this.proxy.sendMessage(
0,
blink.mojom.ManifestManager_RequestManifest_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec.$,
[
]);
}
/**
* @return {Promise<{
url: !url.mojom.Url,
debugInfo: ?blink.mojom.ManifestDebugInfo,
* }>}
*/
requestManifestDebugInfo() {
return this.proxy.sendMessage(
1,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec.$,
[
]);
}
};
/**
* An object which receives request messages for the ManifestManager
* mojom interface. Must be constructed over an object which implements that
* interface.
*
* @export
*/
blink.mojom.ManifestManager = class {
/**
* @param {!blink.mojom.ManifestManagerInterface } impl
*/
constructor(impl) {
this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver;
this.receiver_.registerHandler(
0,
blink.mojom.ManifestManager_RequestManifest_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec.$,
impl.requestManifest.bind(impl));
this.receiver_.registerHandler(
1,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec.$,
impl.requestManifestDebugInfo.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 {!blink.mojom.ManifestManagerProxy}
* @export
*/
static getProxy() {
let proxy = new blink.mojom.ManifestManagerProxy;
Mojo.bindInterface('blink.mojom.ManifestManager',
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 {!blink.mojom.ManifestManagerProxy}
* @export
*/
createProxy() {
let proxy = new blink.mojom.ManifestManagerProxy;
this.receiver_.bindHandle(proxy.$.bindNewPipeAndPassReceiver().handle);
return proxy;
}
};
/**
* @const {string}
* @export
*/
blink.mojom.ManifestManager.$interfaceName =
'blink.mojom.ManifestManager';
/**
* An object which receives request messages for the ManifestManager
* 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
*/
blink.mojom.ManifestManagerCallbackRouter = class {
constructor() {
this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver;
this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
/**
* @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver}
*/
this.requestManifest =
new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(
this.router_);
this.receiver_.registerHandler(
0,
blink.mojom.ManifestManager_RequestManifest_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec.$,
this.requestManifest.createReceiverHandler(true /* expectsResponse */));
/**
* @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver}
*/
this.requestManifestDebugInfo =
new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(
this.router_);
this.receiver_.registerHandler(
1,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec.$,
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec.$,
this.requestManifestDebugInfo.createReceiverHandler(true /* 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 {!blink.mojom.ManifestManagerProxy}
* @export
*/
createProxy() {
let proxy = new blink.mojom.ManifestManagerProxy;
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('blink.mojom.ManifestManager_RequestManifest_ParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
blink.mojom.ManifestManager_RequestManifest_ParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
goog.provide('blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
goog.provide('blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
goog.provide('blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec');
/**
* @const { {$:!mojo.internal.MojomType}}
* @export
*/
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec =
{ $: /** @type {!mojo.internal.MojomType} */ ({}) };
mojo.internal.Struct(
blink.mojom.ManifestManager_RequestManifest_ParamsSpec.$,
'ManifestManager_RequestManifest_Params',
0,
[
]);
goog.provide('blink.mojom.ManifestManager_RequestManifest_Params');
/** @typedef {Object} */
blink.mojom.ManifestManager_RequestManifest_Params;
mojo.internal.Struct(
blink.mojom.ManifestManager_RequestManifest_ResponseParamsSpec.$,
'ManifestManager_RequestManifest_ResponseParams',
16,
[
mojo.internal.StructField(
'url', 0,
0,
url.mojom.UrlSpec.$,
null,
false /* nullable */),
mojo.internal.StructField(
'manifest', 8,
0,
blink.mojom.ManifestSpec.$,
null,
true /* nullable */),
]);
goog.provide('blink.mojom.ManifestManager_RequestManifest_ResponseParams');
/**
* @typedef { {
* url: !url.mojom.Url,
* manifest: (blink.mojom.Manifest|undefined),
* } }
*/
blink.mojom.ManifestManager_RequestManifest_ResponseParams;
mojo.internal.Struct(
blink.mojom.ManifestManager_RequestManifestDebugInfo_ParamsSpec.$,
'ManifestManager_RequestManifestDebugInfo_Params',
0,
[
]);
goog.provide('blink.mojom.ManifestManager_RequestManifestDebugInfo_Params');
/** @typedef {Object} */
blink.mojom.ManifestManager_RequestManifestDebugInfo_Params;
mojo.internal.Struct(
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParamsSpec.$,
'ManifestManager_RequestManifestDebugInfo_ResponseParams',
16,
[
mojo.internal.StructField(
'url', 0,
0,
url.mojom.UrlSpec.$,
null,
false /* nullable */),
mojo.internal.StructField(
'debugInfo', 8,
0,
blink.mojom.ManifestDebugInfoSpec.$,
null,
true /* nullable */),
]);
goog.provide('blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParams');
/**
* @typedef { {
* url: !url.mojom.Url,
* debugInfo: (blink.mojom.ManifestDebugInfo|undefined),
* } }
*/
blink.mojom.ManifestManager_RequestManifestDebugInfo_ResponseParams;