Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: chrome/browser/resources/settings/internet_page/tether_connection_dialog.js

Issue 2755173002: [CrOS Tether] Add a connection dialog to md-settings. (Closed)
Patch Set: Fix closure compiler error. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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
5 /**
6 * @typedef {{
7 * tetherNostDeviceName: string,
8 * batteryPercentage: number,
9 * connectionStrength: number,
10 * isTetherHostCurrentlyOnWifi: boolean
11 * }}
12 */
13 var TetherConnectionData;
14
15 Polymer({
16 is: 'tether-connection-dialog',
17
18 behaviors: [I18nBehavior],
19
20 properties: {
21 /**
22 * The data used to display the tether connection dialog.
23 * @private {!TetherConnectionData|undefined}
24 */
25 tetherData_: {
26 type: Object,
27 // TODO(khorimoto): Remove this and use real data when available.
28 value: {
29 tetherNostDeviceName: 'Pixel XL',
30 batteryPercentage: 100,
31 connectionStrength: 4,
32 isTetherHostCurrentlyOnWifi: false
33 },
34 },
35 },
36
37 open: function() {
38 this.getDialog_().showModal();
39 },
40
41 close: function() {
42 var dialog = this.getDialog_();
43 if (dialog.open)
44 dialog.close();
45 },
46
47 /** @override */
48 ready: function() {
49 this.open();
50 },
51
52 /**
53 * @return {!CrDialogElement}
54 * @private
55 */
56 getDialog_: function() {
57 return /** @type {!CrDialogElement} */ (this.$.dialog);
58 },
59
60 /** @private */
61 onNotNowTap_: function() {
62 this.getDialog_().cancel();
63 },
64
65 /**
66 * @param {!TetherConnectionData|undefined} tetherData
67 * @return {string}
68 * @private
69 */
70 getReceptionIcon_: function(tetherData) {
71 var connectionStrength;
72
73 if (!tetherData || !tetherData.connectionStrength) {
74 connectionStrength = 0;
75 } else {
76 // Ensure that 0 <= connectionStrength <= 4, since these values are the
77 // limits of the cellular strength icons.
78 connectionStrength =
79 Math.min(Math.max(tetherData.connectionStrength, 0), 4);
80 }
81
82 return 'device:signal-cellular-' + connectionStrength + '-bar';
83 }
84 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698