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

Unified Diff: ui/webui/resources/cr_elements/cr_network_list/cr_network_list.js

Issue 1100993002: Implement md-settings network lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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: ui/webui/resources/cr_elements/cr_network_list/cr_network_list.js
diff --git a/ui/webui/resources/cr_elements/cr_network_list/cr_network_list.js b/ui/webui/resources/cr_elements/cr_network_list/cr_network_list.js
new file mode 100644
index 0000000000000000000000000000000000000000..4fcd048b0a2da1710d284d589b1869a78a6d1f25
--- /dev/null
+++ b/ui/webui/resources/cr_elements/cr_network_list/cr_network_list.js
@@ -0,0 +1,72 @@
+// 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.
+
+/**
+ * @fileoverview Polymer element for displaying a collapsable list of networks.
+ */
+
+/**
+ * Polymer class definition for 'cr-network-list'.
+ * @element cr-network-list
+ */
+Polymer('cr-network-list', {
+ publish: {
+ /**
+ * The maximum height in pixels for the list.
+ *
+ * @attribute maxHeight
+ * @type {number}
+ * @default 1000
+ */
+ maxHeight: 1000,
+
+ /**
+ * The list of network state properties for the items to display.
+ *
+ * @attribute networks
+ * @type {?Array<!CrOncDataElement>}
+ * @default null
+ */
+ networks: null,
+
+ /**
+ * True if the list is opened.
+ *
+ * @attribute opened
+ * @type {boolean}
+ * @default false
+ */
+ opened: false,
+ },
+
+ /** @override */
+ created: function() {
+ this.networks = [];
+ },
+
+ /**
+ * Polymer maxHeight changed method.
+ */
+ maxHeightChanged: function() {
+ this.$.container.style.maxHeight = this.maxHeight + "px";
+ },
+
+ /**
+ * Called when the cr-collapse element changes size (i.e. is opened).
+ * @private
+ */
+ onResized_: function() {
+ if (this.opened)
+ this.$.networkList.updateSize();
+ },
+
+ /**
+ * Event triggered when a list item is selected.
+ * @param {!{detail: CrOncDataElement}} event
+ * @private
+ */
+ onSelected_: function(event) {
+ this.fire('selected', event.detail.item.networkState);
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698