summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/settings/internet_page/network_proxy_input.js
blob: a4806ff14677a9db9820c4ac95394dcda473bc9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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 'changed' event is
 * fired with the combined url and port values passed as a single string,
 * url:port.
 */
Polymer({
  is: 'network-proxy-input',

  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
   */
  onValueChanged_: function() {
    var port = parseInt(this.value.Port);
    if (isNaN(port))
      port = 80;
    this.value.Port = port;
    this.fire('changed', { value: this.value });
  }
});