blob: d0cde376ece92436c81c600f370bf19f03a06902 [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 './infobar_internals.mojom-webui.js';
import type {PageHandlerInterface} from './infobar_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;