import { WebViewWindow } from './webViewWindow'; import { Logger } from 'common/logger'; import { ContextMenuBuilder, IContextMenuAction } from 'background/contextMenuBuilder'; export class LicenseWindowController implements IContextMenuAction { private licenseWindow: WebViewWindow; private logger = Logger.getInstance(); constructor() { this.licenseWindow = new WebViewWindow(); this.createContextMenuItem(); } public loadLicenseWindow() { chrome.app.window.create( 'licenses.html', { frame: 'none', hidden: true, id: 'licenseDialog', singleton: true, resizable: false }, (win: chrome.app.window.AppWindow) => { this.licenseWindow.setAppWindow(win); this.licenseWindow.onWindowLoad(() => { var w = 500; var h = 520; const bounds = { width: w, height: h, top: Math.round(screen.height / 2 - h / 2), left: Math.round(screen.width / 2 - w / 2) }; this.licenseWindow.setSizeAndPosition(bounds); this.licenseWindow.makeModal(); }); } ); } createContextMenuItem() { ContextMenuBuilder.getInstance().addContextMenuAction( chrome.i18n.getMessage('context_menu_third_party_licenses'), this ); } runContextMenuAction() { this.loadLicenseWindow(); } }