Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 1 | // Copyright 2018 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 | |
Tim van der Lippe | aa61faf | 2021-04-07 15:32:07 | [diff] [blame] | 5 | import * as i18n from '../../core/i18n/i18n.js'; |
Vidal Guillermo Diazleal Ortega | 9b0bc5b | 2021-02-22 22:12:04 | [diff] [blame] | 6 | |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 7 | import {VBox} from './Widget.js'; |
| 8 | |
Simon Zünd | f6afbca | 2021-03-02 06:11:14 | [diff] [blame] | 9 | const UIStrings = { |
Vidal Guillermo Diazleal Ortega | 9b0bc5b | 2021-02-22 22:12:04 | [diff] [blame] | 10 | /** |
| 11 | *@description Text in dialog box when the target page crashed |
| 12 | */ |
| 13 | devtoolsWasDisconnectedFromThe: 'DevTools was disconnected from the page.', |
| 14 | /** |
| 15 | *@description Text content of content element |
| 16 | */ |
| 17 | oncePageIsReloadedDevtoolsWill: 'Once page is reloaded, DevTools will automatically reconnect.', |
| 18 | }; |
Tim van der Lippe | aa61faf | 2021-04-07 15:32:07 | [diff] [blame] | 19 | const str_ = i18n.i18n.registerUIStrings('ui/legacy/TargetCrashedScreen.ts', UIStrings); |
Vidal Guillermo Diazleal Ortega | 9b0bc5b | 2021-02-22 22:12:04 | [diff] [blame] | 20 | const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); |
Paul Lewis | 9950e18 | 2019-12-16 16:06:07 | [diff] [blame] | 21 | export class TargetCrashedScreen extends VBox { |
Jan Scheffler | 01eab3c | 2021-08-16 17:18:07 | [diff] [blame^] | 22 | private readonly hideCallback: () => void; |
Jan Scheffler | cef7829 | 2021-03-29 18:19:35 | [diff] [blame] | 23 | constructor(hideCallback: () => void) { |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 24 | super(true); |
Jack Franklin | 84442c6 | 2021-06-28 15:02:06 | [diff] [blame] | 25 | this.registerRequiredCSS('ui/legacy/targetCrashedScreen.css'); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 26 | this.contentElement.createChild('div', 'message').textContent = |
Vidal Guillermo Diazleal Ortega | 9b0bc5b | 2021-02-22 22:12:04 | [diff] [blame] | 27 | i18nString(UIStrings.devtoolsWasDisconnectedFromThe); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 28 | this.contentElement.createChild('div', 'message').textContent = |
Vidal Guillermo Diazleal Ortega | 9b0bc5b | 2021-02-22 22:12:04 | [diff] [blame] | 29 | i18nString(UIStrings.oncePageIsReloadedDevtoolsWill); |
Jan Scheffler | 01eab3c | 2021-08-16 17:18:07 | [diff] [blame^] | 30 | this.hideCallback = hideCallback; |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 31 | } |
| 32 | |
Jan Scheffler | cef7829 | 2021-03-29 18:19:35 | [diff] [blame] | 33 | willHide(): void { |
Jan Scheffler | 01eab3c | 2021-08-16 17:18:07 | [diff] [blame^] | 34 | this.hideCallback.call(null); |
Blink Reformat | 4c46d09 | 2018-04-07 15:32:37 | [diff] [blame] | 35 | } |
Tim van der Lippe | 0830b3d | 2019-10-03 13:20:07 | [diff] [blame] | 36 | } |