| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 Polymer({ | 5 Polymer({ |
| 6 is: 'device-list', | 6 is: 'device-list', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 /** | 9 /** |
| 10 * The label of the list to be displayed. | 10 * The label of the list to be displayed. |
| 11 * @type {string} | 11 * @type {string} |
| 12 */ | 12 */ |
| 13 label: { | 13 label: { |
| 14 type: String, | 14 type: String, |
| 15 value: 'Device List', | 15 value: 'Device List', |
| 16 }, | 16 }, |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Info of the devices contained in the list. | 19 * Info of the devices contained in the list. |
| 20 * @type {Array<DeviceInfo>} | 20 * @type {Array<DeviceInfo>} |
| 21 */ | 21 */ |
| 22 devices: Array, | 22 devices: Array, |
| 23 }, | 23 }, |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Handles when the toggle connection button is clicked for a list item. |
| 27 * @param {Event} event |
| 28 */ |
| 29 toggleConnection_: function(event) { |
| 30 var deviceInfo = event.model.item; |
| 31 chrome.send('toggleConnection', [deviceInfo.publicKey]); |
| 32 }, |
| 33 |
| 34 /** |
| 26 * @param {string} reason The device ineligibility reason. | 35 * @param {string} reason The device ineligibility reason. |
| 27 * @return {string} The prettified ineligibility reason. | 36 * @return {string} The prettified ineligibility reason. |
| 28 * @private | 37 * @private |
| 29 */ | 38 */ |
| 30 prettifyReason_: function(reason) { | 39 prettifyReason_: function(reason) { |
| 31 if (reason == null || reason == '') | 40 if (reason == null || reason == '') |
| 32 return ''; | 41 return ''; |
| 33 var reasonWithSpaces = reason.replace(/([A-Z])/g, ' $1'); | 42 var reasonWithSpaces = reason.replace(/([A-Z])/g, ' $1'); |
| 34 return reasonWithSpaces[0].toUpperCase() + reasonWithSpaces.slice(1); | 43 return reasonWithSpaces[0].toUpperCase() + reasonWithSpaces.slice(1); |
| 35 }, | 44 }, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return 'notification:system-update'; | 94 return 'notification:system-update'; |
| 86 case 'bluetoothNotSupported': | 95 case 'bluetoothNotSupported': |
| 87 return 'device:bluetooth-disabled'; | 96 return 'device:bluetooth-disabled'; |
| 88 case 'deviceOffline': | 97 case 'deviceOffline': |
| 89 return 'device:signal-cellular-off'; | 98 return 'device:signal-cellular-off'; |
| 90 case 'invalidCredentials': | 99 case 'invalidCredentials': |
| 91 return 'notification:sync-problem'; | 100 return 'notification:sync-problem'; |
| 92 default: | 101 default: |
| 93 return 'error'; | 102 return 'error'; |
| 94 }; | 103 }; |
| 95 } | 104 }, |
| 105 |
| 106 /** |
| 107 * @param {number} userPresence |
| 108 * @return {string} |
| 109 */ |
| 110 getUserPresenceText_: function(userPresence) { |
| 111 var userPresenceMap = { |
| 112 0: 'User Present', |
| 113 1: 'User Absent', |
| 114 2: 'User Presence Unknown', |
| 115 }; |
| 116 return userPresenceMap[userPresence]; |
| 117 }, |
| 118 |
| 119 /** |
| 120 * @param {number} screenLock |
| 121 * @return {string} |
| 122 */ |
| 123 getScreenLockText_: function(screenLock) { |
| 124 var screenLockMap = { |
| 125 0: 'Secure Screen Lock Enabled', |
| 126 1: 'Secure Screen Lock Disabled', |
| 127 2: 'Secure Screen Lock State Unknown', |
| 128 }; |
| 129 return screenLockMap[screenLock]; |
| 130 }, |
| 131 |
| 132 /** |
| 133 * @param {number} trustAgent |
| 134 * @return {string} |
| 135 */ |
| 136 getTrustAgentText_: function(trustAgent) { |
| 137 var trustAgentMap = { |
| 138 0: 'Trust Agent Enabled', |
| 139 1: 'Trust Agent Disabled', |
| 140 2: 'Trust Agent Unsupported', |
| 141 }; |
| 142 return trustAgentMap[trustAgent]; |
| 143 }, |
| 96 }); | 144 }); |
| OLD | NEW |