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

Unified Diff: components/proximity_auth/webui/resources/device-list.js

Issue 1108713002: Add chrome://proximity-auth UI implemented with Polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use hidden?= Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/webui/resources/device-list.js
diff --git a/components/proximity_auth/webui/resources/device-list.js b/components/proximity_auth/webui/resources/device-list.js
new file mode 100644
index 0000000000000000000000000000000000000000..23e79183b483f6508f2bbb9ca93b03088b5ebd4c
--- /dev/null
+++ b/components/proximity_auth/webui/resources/device-list.js
@@ -0,0 +1,76 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer('device-list', {
+ publish: {
+ /**
+ * The label of the list to be displayed.
+ * @type {string}
+ */
+ label: 'Device List',
+
+ /**
+ * Info of the devices contained in the list.
+ * @type {Array.<DeviceInfo>}
+ */
+ devices: null
+ },
+
+ /**
+ * Called when an instance is created.
+ */
+ created: function() {
+ this.devices = [];
+ },
+
+ /**
+ * @param {string} reason The device ineligibility reason.
+ * @return {string} The prettified ineligibility reason.
+ * @private
+ */
+ prettifyReason_: function(reason) {
+ if (reason == null)
+ return '';
+ var reasonWithSpaces = reason.replace(/([A-Z])/g, ' $1');
+ return reasonWithSpaces[0].toUpperCase() + reasonWithSpaces.slice(1);
+ },
+
+ /**
+ * @param {string} connectionStatus The Bluetooth connection status.
+ * @return {string} The icon id to be shown for the connection state.
+ * @private
+ */
+ getIconForConnection_: function(connectionStatus) {
+ switch (connectionStatus) {
+ case 'connected':
+ return 'device:bluetooth-connected';
+ case 'disconnected':
+ return 'device:bluetooth';
+ case 'connecting':
+ return 'device:bluetooth-searching';
+ default:
+ return 'device:bluetooth-disabled';
+ }
+ },
+
+ /**
+ * @param {string} reason The device ineligibility reason.
+ * @return {string} The icon id to be shown for the ineligibility reason.
+ * @private
+ */
+ getIconForIneligibilityReason_: function(reason) {
+ switch (reason) {
+ case 'badOsVersion':
+ return 'notification:system-update';
+ case 'bluetoothNotSupported':
+ return 'device:bluetooth-disabled';
+ case 'deviceOffline':
+ return 'device:signal-cellular-off';
+ case 'invalidCredentials':
+ return 'notification:sync-problem';
+ default:
+ return 'error';
+ };
+ }
+});
« no previous file with comments | « components/proximity_auth/webui/resources/device-list.html ('k') | components/proximity_auth/webui/resources/local-state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698