blob: 4d600e4a3a5d94850bf976c0bfbd0a5731842ee1 [file] [log] [blame]
Paul Lewis8cddf9932019-09-27 16:40:071// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Jan Scheffler830467c2021-02-25 13:44:475/* eslint-disable rulesdir/no_underscored_properties */
6
Tim van der Lippebb352e62021-04-01 17:57:287import * as i18n from '../../core/i18n/i18n.js';
Tim van der Lippeaa61faf2021-04-07 15:32:078import * as UI from '../../ui/legacy/legacy.js';
Tim van der Lippe7946bbc2020-02-13 13:58:429
Tim van der Lippebfbb58f2021-02-25 17:34:1910import type {OverviewController} from './CSSOverviewController.js';
11import {Events} from './CSSOverviewController.js';
Tim van der Lippe9d0cb5f2020-01-09 14:10:3812
Simon Zündfbfd1072021-03-01 07:38:5313const UIStrings = {
Christy Chenb6e28b62021-01-22 08:18:0014 /**
15 *@description Text to cancel something
16 */
17 cancel: 'Cancel',
18};
Tim van der Lippe1d7474a2021-03-19 15:41:0619const str_ = i18n.i18n.registerUIStrings('panels/css_overview/CSSOverviewProcessingView.ts', UIStrings);
Christy Chenb6e28b62021-01-22 08:18:0020const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
Tim van der Lippe7946bbc2020-02-13 13:58:4221export class CSSOverviewProcessingView extends UI.Widget.Widget {
Jan Scheffler830467c2021-02-25 13:44:4722 _formatter: Intl.NumberFormat;
23 _controller: OverviewController;
24 fragment?: UI.Fragment.Fragment;
25 constructor(controller: OverviewController) {
Paul Lewis8cddf9932019-09-27 16:40:0726 super();
Tim van der Lippe1d7474a2021-03-19 15:41:0627 this.registerRequiredCSS('panels/css_overview/cssOverviewProcessingView.css', {enableLegacyPatching: false});
Paul Lewis8cddf9932019-09-27 16:40:0728
29 this._formatter = new Intl.NumberFormat('en-US');
30 this._controller = controller;
31 this._render();
32 }
33
Jan Scheffler830467c2021-02-25 13:44:4734 _render(): void {
Tim van der Lippe7946bbc2020-02-13 13:58:4235 const cancelButton = UI.UIUtils.createTextButton(
Christy Chenb6e28b62021-01-22 08:18:0036 i18nString(UIStrings.cancel), () => this._controller.dispatchEventToListeners(Events.RequestOverviewCancel), '',
Paul Lewis8cddf9932019-09-27 16:40:0737 true /* primary */);
38 this.setDefaultFocusedElement(cancelButton);
39
Tim van der Lippe7946bbc2020-02-13 13:58:4240 this.fragment = UI.Fragment.Fragment.build`
Paul Lewis8cddf9932019-09-27 16:40:0741 <div class="vbox overview-processing-view">
42 <h1>Processing page</h1>
43 <div>${cancelButton}</div>
Paul Lewis8cddf9932019-09-27 16:40:0744 </div>
45 `;
46
47 this.contentElement.appendChild(this.fragment.element());
48 this.contentElement.style.overflow = 'auto';
49 }
Paul Lewis4da3b302019-11-21 14:23:4750}