summaryrefslogtreecommitdiff
path: root/chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js')
-rw-r--r--chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js b/chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js
new file mode 100644
index 00000000000..63609b074ce
--- /dev/null
+++ b/chromium/ui/webui/resources/cr_components/chromeos/network/network_proxy_input.js
@@ -0,0 +1,57 @@
+// 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 and editing a single
+ * network proxy value. When the URL or port changes, a 'proxy-change' event is
+ * fired with the combined url and port values passed as a single string,
+ * url:port.
+ */
+Polymer({
+ is: 'network-proxy-input',
+
+ behaviors: [I18nBehavior],
+
+ properties: {
+ /**
+ * Whether or not the proxy value can be edited.
+ */
+ editable: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * A label for the proxy value.
+ */
+ label: {
+ type: String,
+ value: 'Proxy',
+ },
+
+ /**
+ * The proxy object.
+ * @type {!CrOnc.ProxyLocation}
+ */
+ value: {
+ type: Object,
+ value: function() {
+ return {Host: '', Port: 80};
+ },
+ notify: true,
+ },
+ },
+
+ /**
+ * Event triggered when an input value changes.
+ * @private
+ */
+ onValueChange_: function() {
+ var port = parseInt(this.value.Port, 10);
+ if (isNaN(port))
+ port = 80;
+ this.value.Port = port;
+ this.fire('proxy-change', {value: this.value});
+ }
+});