Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 Polymer('device-list', { | |
| 6 publish: { | |
| 7 /** | |
| 8 * The label of the list to be displayed. | |
| 9 * @type {string} | |
| 10 */ | |
| 11 label: 'Device List', | |
| 12 | |
| 13 /** | |
| 14 * Info of the devices contained in the list. | |
| 15 * @type {Array.<DeviceInfo>} | |
| 16 */ | |
| 17 devices: [] | |
|
michaelpg
2015/04/28 04:00:49
Objects (inc. arrays) should be initialized in the
Tim Song
2015/04/28 19:41:33
Done.
| |
| 18 }, | |
| 19 | |
| 20 /** | |
| 21 * @param {string} reason The device ineligibility reason. | |
| 22 * @return {string} The prettified ineligibility reason. | |
| 23 * @private | |
| 24 */ | |
| 25 prettifyReason_: function(reason) { | |
| 26 if (reason == null) | |
| 27 return ''; | |
| 28 var reasonWithSpaces = reason.replace(/([A-Z])/g, ' $1'); | |
| 29 return reasonWithSpaces[0].toUpperCase() + reasonWithSpaces.slice(1); | |
| 30 }, | |
| 31 | |
| 32 /** | |
| 33 * @param {string} connectionStatus The Bluetooth connection status. | |
| 34 * @return {string} The icon id to be shown for the connection state. | |
| 35 * @private | |
| 36 */ | |
| 37 getIconForConnection_: function(connectionStatus) { | |
| 38 switch (connectionStatus) { | |
| 39 case 'connected': | |
| 40 return 'device:bluetooth-connected'; | |
| 41 case 'disconnected': | |
| 42 return 'device:bluetooth'; | |
| 43 case 'connecting': | |
| 44 return 'device:bluetooth-searching'; | |
| 45 default: | |
| 46 return 'device:bluetooth-disabled'; | |
| 47 } | |
| 48 }, | |
| 49 | |
| 50 /** | |
| 51 * @param {string} reason The device ineligibility reason. | |
| 52 * @return {string} The icon id to be shown for the ineligibility reason. | |
| 53 * @private | |
| 54 */ | |
| 55 getIconForIneligibilityReason_: function(reason) { | |
| 56 switch (reason) { | |
| 57 case 'badOsVersion': | |
| 58 return 'notification:system-update'; | |
| 59 case 'bluetoothNotSupported': | |
| 60 return 'device:bluetooth-disabled'; | |
| 61 case 'deviceOffline': | |
| 62 return 'device:signal-cellular-off'; | |
| 63 case 'invalidCredentials': | |
| 64 return 'notification:sync-problem'; | |
| 65 default: | |
| 66 return 'error'; | |
| 67 }; | |
| 68 } | |
| 69 }); | |
| OLD | NEW |