blob: 430523608642c447a3fc0693ab9b03edf9c27458 [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {PageCallbackRouter, PageHandlerFactory, PageHandlerRemote} from './actor_internals.mojom-webui.js';
import type {PageHandlerInterface} from './actor_internals.mojom-webui.js';
export class BrowserProxy {
callbackRouter: PageCallbackRouter;
handler: PageHandlerInterface;
private constructor() {
this.callbackRouter = new PageCallbackRouter();
this.handler = new PageHandlerRemote();
PageHandlerFactory.getRemote().createPageHandler(
this.callbackRouter.$.bindNewPipeAndPassRemote(),
(this.handler as PageHandlerRemote).$.bindNewPipeAndPassReceiver());
}
static getInstance(): BrowserProxy {
return instance || (instance = new BrowserProxy());
}
static setInstance(proxy: BrowserProxy) {
instance = proxy;
}
}
let instance: BrowserProxy|null = null;