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

Unified Diff: chrome/browser/resources/settings/internet_page/network_config_select.js

Issue 2848683003: MD Settings: Add settings-internet-config (WiFi only, no certs) (Closed)
Patch Set: Feedback, add network-confg-input + select Created 3 years, 7 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: chrome/browser/resources/settings/internet_page/network_config_select.js
diff --git a/chrome/browser/resources/settings/internet_page/network_config_select.js b/chrome/browser/resources/settings/internet_page/network_config_select.js
new file mode 100644
index 0000000000000000000000000000000000000000..1ec5dcc06eb399ed3c42095eaef27461eb1a2f5a
--- /dev/null
+++ b/chrome/browser/resources/settings/internet_page/network_config_select.js
@@ -0,0 +1,62 @@
+// Copyright 2017 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 network configuration selection menus.
+ */
+Polymer({
+ is: 'network-config-select',
+
+ behaviors: [I18nBehavior],
+
+ properties: {
+ label: String,
+
+ disabled: Boolean,
+
+ /**
+ * Array of item values to select from.
+ * @type {!Array<string>}
+ */
+ items: Array,
+
+ /** Prefix used to look up ONC property names. */
+ oncPrefix: String,
+
+ /** Select item value */
+ value: {
+ type: String,
+ notify: true,
+ },
+ },
+
+ observers: ['updateSelected_(items, value)'],
+
+ /**
+ * Ensure that the <select> value is updated when |items| or |value| changes.
+ * @private
+ */
+ updateSelected_: function() {
+ // Wait for the dom-repeat to populate the <option> entries.
+ this.async(function() {
+ var select = this .$$('select');
michaelpg 2017/05/22 20:01:53 nit: remove space before .
stevenjb 2017/05/22 20:36:39 Done.
+ if (select.value != this.value)
+ select.value = this.value;
+ });
+ },
+
+ /**
+ * @param {string} key
+ * @param {string} prefix
+ * @return {string} The text to display for the onc value.
+ * @private
+ */
+ getOncLabel_: function(key, prefix) {
+ var oncKey = 'Onc' + prefix.replace(/\./g, '-') + '_' + key;
+ if (this.i18nExists(oncKey))
+ return this.i18n(oncKey);
+ assertNotReached();
+ return key;
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698