| // 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('url.mojom.Origin'); |
| goog.require('blink.mojom.StorageArea'); |
| |
| |
| |
| |
| |
| |
| goog.provide('blink.mojom.SessionStorageNamespace'); |
| goog.provide('blink.mojom.SessionStorageNamespaceCallbackRouter'); |
| goog.provide('blink.mojom.SessionStorageNamespaceInterface'); |
| goog.provide('blink.mojom.SessionStorageNamespaceProxy'); |
| goog.provide('blink.mojom.SessionStorageNamespaceRequest'); |
| |
| |
| /** @export */ |
| blink.mojom.SessionStorageNamespaceRequest = class { |
| /** @param {!MojoHandle} handle */ |
| constructor(handle) { |
| /** @public {!MojoHandle} */ |
| this.handle = handle; |
| } |
| }; |
| |
| /** @interface */ |
| blink.mojom.SessionStorageNamespaceInterface = class { |
| |
| /** |
| * @param { !url.mojom.Origin } origin |
| * @param { !Object } area |
| */ |
| |
| openArea(origin, area) {} |
| |
| /** |
| * @param { !string } cloneToNamespace |
| */ |
| |
| clone(cloneToNamespace) {} |
| }; |
| |
| /** |
| * @export |
| * @implements { blink.mojom.SessionStorageNamespaceInterface } |
| */ |
| blink.mojom.SessionStorageNamespaceProxy = class { |
| /** @param {MojoHandle=} opt_handle */ |
| constructor(opt_handle) { |
| /** |
| * @private {!mojo.internal.interfaceSupport.InterfaceRemoteBase<!blink.mojom.SessionStorageNamespaceRequest>} |
| */ |
| this.proxy = |
| new mojo.internal.interfaceSupport.InterfaceRemoteBase( |
| blink.mojom.SessionStorageNamespaceRequest, |
| opt_handle); |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper<!blink.mojom.SessionStorageNamespaceRequest>} |
| */ |
| this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy); |
| |
| /** @public {!mojo.internal.interfaceSupport.ConnectionErrorEventRouter} */ |
| this.onConnectionError = this.proxy.getConnectionErrorEventRouter(); |
| } |
| |
| |
| /** |
| * @param { !url.mojom.Origin } origin |
| * @param { !Object } area |
| */ |
| |
| openArea( |
| origin, |
| area) { |
| this.proxy.sendMessage( |
| 0, |
| blink.mojom.SessionStorageNamespace_OpenArea_ParamsSpec.$, |
| null, |
| [ |
| origin, |
| area |
| ]); |
| } |
| |
| |
| /** |
| * @param { !string } cloneToNamespace |
| */ |
| |
| clone( |
| cloneToNamespace) { |
| this.proxy.sendMessage( |
| 1, |
| blink.mojom.SessionStorageNamespace_Clone_ParamsSpec.$, |
| null, |
| [ |
| cloneToNamespace |
| ]); |
| } |
| }; |
| |
| /** |
| * An object which receives request messages for the SessionStorageNamespace |
| * mojom interface. Must be constructed over an object which implements that |
| * interface. |
| * |
| * @export |
| */ |
| blink.mojom.SessionStorageNamespace = class { |
| /** |
| * @param {!blink.mojom.SessionStorageNamespaceInterface } impl |
| */ |
| constructor(impl) { |
| this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver; |
| |
| this.receiver_.registerHandler( |
| 0, |
| blink.mojom.SessionStorageNamespace_OpenArea_ParamsSpec.$, |
| null, |
| impl.openArea.bind(impl)); |
| this.receiver_.registerHandler( |
| 1, |
| blink.mojom.SessionStorageNamespace_Clone_ParamsSpec.$, |
| null, |
| impl.clone.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.SessionStorageNamespaceProxy} |
| * @export |
| */ |
| static getProxy() { |
| let proxy = new blink.mojom.SessionStorageNamespaceProxy; |
| Mojo.bindInterface('blink.mojom.SessionStorageNamespace', |
| 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.SessionStorageNamespaceProxy} |
| * @export |
| */ |
| createProxy() { |
| let proxy = new blink.mojom.SessionStorageNamespaceProxy; |
| this.receiver_.bindHandle(proxy.$.bindNewPipeAndPassReceiver().handle); |
| return proxy; |
| } |
| }; |
| |
| |
| /** |
| * @const {string} |
| * @export |
| */ |
| blink.mojom.SessionStorageNamespace.$interfaceName = |
| 'blink.mojom.SessionStorageNamespace'; |
| |
| /** |
| * An object which receives request messages for the SessionStorageNamespace |
| * 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.SessionStorageNamespaceCallbackRouter = class { |
| constructor() { |
| this.receiver_ = new mojo.internal.interfaceSupport.InterfaceReceiver; |
| this.router_ = new mojo.internal.interfaceSupport.CallbackRouter; |
| |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.openArea = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.receiver_.registerHandler( |
| 0, |
| blink.mojom.SessionStorageNamespace_OpenArea_ParamsSpec.$, |
| null, |
| this.openArea.createReceiverHandler(false /* expectsResponse */)); |
| /** |
| * @public {!mojo.internal.interfaceSupport.InterfaceCallbackReceiver} |
| */ |
| this.clone = |
| new mojo.internal.interfaceSupport.InterfaceCallbackReceiver( |
| this.router_); |
| |
| this.receiver_.registerHandler( |
| 1, |
| blink.mojom.SessionStorageNamespace_Clone_ParamsSpec.$, |
| null, |
| this.clone.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 {!blink.mojom.SessionStorageNamespaceProxy} |
| * @export |
| */ |
| createProxy() { |
| let proxy = new blink.mojom.SessionStorageNamespaceProxy; |
| 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.SessionStorageNamespace_OpenArea_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| blink.mojom.SessionStorageNamespace_OpenArea_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| goog.provide('blink.mojom.SessionStorageNamespace_Clone_ParamsSpec'); |
| /** |
| * @const { {$:!mojo.internal.MojomType}} |
| * @export |
| */ |
| blink.mojom.SessionStorageNamespace_Clone_ParamsSpec = |
| { $: /** @type {!mojo.internal.MojomType} */ ({}) }; |
| |
| |
| |
| |
| mojo.internal.Struct( |
| blink.mojom.SessionStorageNamespace_OpenArea_ParamsSpec.$, |
| 'SessionStorageNamespace_OpenArea_Params', |
| 16, |
| [ |
| mojo.internal.StructField( |
| 'origin', 0, |
| 0, |
| url.mojom.OriginSpec.$, |
| null, |
| false /* nullable */), |
| mojo.internal.StructField( |
| 'area', 8, |
| 0, |
| mojo.internal.AssociatedInterfaceRequest(blink.mojom.StorageArea), |
| null, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('blink.mojom.SessionStorageNamespace_OpenArea_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * origin: !url.mojom.Origin, |
| * area: !Object, |
| * } } |
| */ |
| |
| blink.mojom.SessionStorageNamespace_OpenArea_Params; |
| |
| |
| |
| mojo.internal.Struct( |
| blink.mojom.SessionStorageNamespace_Clone_ParamsSpec.$, |
| 'SessionStorageNamespace_Clone_Params', |
| 8, |
| [ |
| mojo.internal.StructField( |
| 'cloneToNamespace', 0, |
| 0, |
| mojo.internal.String, |
| null, |
| false /* nullable */), |
| ]); |
| |
| goog.provide('blink.mojom.SessionStorageNamespace_Clone_Params'); |
| |
| |
| /** |
| * @typedef { { |
| * cloneToNamespace: !string, |
| * } } |
| */ |
| |
| blink.mojom.SessionStorageNamespace_Clone_Params; |
| |