1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
ash / webui / diagnostics_ui / resources / network_info.ts [blame]
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import './cellular_info.js';
import './diagnostics_shared.css.js';
import './ethernet_info.js';
import './wifi_info.js';
import {PolymerElementProperties} from 'chrome://resources/polymer/v3_0/polymer/interfaces.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {Network, NetworkType} from './network_health_provider.mojom-webui.js';
import {getTemplate} from './network_info.html.js';
/**
* @fileoverview
* 'network-info' is responsible for displaying specialized data points for a
* supported network type (Ethernet, WiFi, Cellular).
*/
export class NetworkInfoElement extends PolymerElement {
static get is(): 'network-info' {
return 'network-info' as const;
}
static get template(): HTMLTemplateElement {
return getTemplate();
}
static get properties(): PolymerElementProperties {
return {
/** @type {!Network} */
network: {
type: Object,
},
};
}
network: Network;
protected isWifiNetwork(): boolean {
return this.network.type === NetworkType.kWiFi;
}
protected isCellularNetwork(): boolean {
return this.network.type === NetworkType.kCellular;
}
protected isEthernetNetwork(): boolean {
return this.network.type === NetworkType.kEthernet;
}
}
declare global {
interface HTMLElementTagNameMap {
[NetworkInfoElement.is]: NetworkInfoElement;
}
}
customElements.define(NetworkInfoElement.is, NetworkInfoElement);