blob: 37a272f5986982199f23d8647dba7c87e80af0b8 [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview A helper object used by the chrome://waffle page to
* interact with the browser.
*/
import {PageHandlerFactory, PageHandlerInterface, PageHandlerRemote} from './waffle.mojom-webui.js';
export interface WaffleChoice {
name: string;
}
export class WaffleBrowserProxy {
handler: PageHandlerInterface;
constructor() {
this.handler = new PageHandlerRemote();
const factory = PageHandlerFactory.getRemote();
factory.createPageHandler(
(this.handler as PageHandlerRemote).$.bindNewPipeAndPassReceiver());
}
static getInstance(): WaffleBrowserProxy {
return instance || (instance = new WaffleBrowserProxy());
}
static setInstance(obj: WaffleBrowserProxy) {
instance = obj;
}
}
let instance: WaffleBrowserProxy|null = null;