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

Side by Side Diff: chrome/browser/resources/settings/internet_page/network_proxy.js

Issue 2422423002: Use md-select instead of paper-dropdown-menu-light in internet page (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Polymer element for displaying and editing network proxy 6 * @fileoverview Polymer element for displaying and editing network proxy
7 * values. 7 * values.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'network-proxy', 10 is: 'network-proxy',
(...skipping 19 matching lines...) Expand all
30 30
31 /** 31 /**
32 * UI visible / edited proxy configuration. 32 * UI visible / edited proxy configuration.
33 * @type {!CrOnc.ProxySettings} 33 * @type {!CrOnc.ProxySettings}
34 */ 34 */
35 proxy: { 35 proxy: {
36 type: Object, 36 type: Object,
37 value: function() { 37 value: function() {
38 return this.createDefaultProxySettings_(); 38 return this.createDefaultProxySettings_();
39 }, 39 },
40 observer: 'proxyChanged_',
40 }, 41 },
41 42
42 /** The Web Proxy Auto Discovery URL extracted from networkProperties. */ 43 /** The Web Proxy Auto Discovery URL extracted from networkProperties. */
43 WPAD: { 44 WPAD: {
44 type: String, 45 type: String,
45 value: '', 46 value: '',
46 }, 47 },
47 48
48 /** 49 /**
49 * Whether or not to use the same manual proxy for all protocols. 50 * Whether or not to use the same manual proxy for all protocols.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 */ 96 */
96 savedManual_: undefined, 97 savedManual_: undefined,
97 98
98 /** 99 /**
99 * Saved ExcludeDomains properties so that switching to a non-Manual type does 100 * Saved ExcludeDomains properties so that switching to a non-Manual type does
100 * not loose any set exclusions while the UI is open. 101 * not loose any set exclusions while the UI is open.
101 * @private {!Array<string>|undefined} 102 * @private {!Array<string>|undefined}
102 */ 103 */
103 savedExcludeDomains_: undefined, 104 savedExcludeDomains_: undefined,
104 105
105 /** 106 /** @private */
106 * Polymer networkProperties changed method.
107 */
108 networkPropertiesChanged_: function() { 107 networkPropertiesChanged_: function() {
109 if (!this.networkProperties) 108 if (!this.networkProperties)
110 return; 109 return;
111 110
112 /** @type {!CrOnc.ProxySettings} */ 111 /** @type {!CrOnc.ProxySettings} */
113 var proxy = this.createDefaultProxySettings_(); 112 var proxy = this.createDefaultProxySettings_();
114 /** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */ 113 /** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */
115 var proxySettings = this.networkProperties.ProxySettings; 114 var proxySettings = this.networkProperties.ProxySettings;
116 if (proxySettings) { 115 if (proxySettings) {
117 proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ ( 116 proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ (
(...skipping 22 matching lines...) Expand all
140 proxy.Manual = proxy.Manual || this.savedManual_; 139 proxy.Manual = proxy.Manual || this.savedManual_;
141 140
142 this.proxy = proxy; 141 this.proxy = proxy;
143 142
144 // Set the Web Proxy Auto Discovery URL. 143 // Set the Web Proxy Auto Discovery URL.
145 var ipv4 = 144 var ipv4 =
146 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4); 145 CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
147 this.WPAD = (ipv4 && ipv4.WebProxyAutoDiscoveryUrl) || ''; 146 this.WPAD = (ipv4 && ipv4.WebProxyAutoDiscoveryUrl) || '';
148 }, 147 },
149 148
149 /** @private */
150 proxyChanged_: function() {
151 this.$.proxyType.value = this.proxy.Type;
dpapad 2016/10/17 22:57:05 Same question here. Can we use a 1-way binding to
stevenjb 2016/10/17 23:58:01 Acknowledged.
152 },
153
154 /** @private */
155 useSameProxyChanged_: function() {
156 this.sendProxyChange_();
157 },
158
150 /** 159 /**
151 * @return {CrOnc.ProxySettings} An empty/default proxy settings object. 160 * @return {CrOnc.ProxySettings} An empty/default proxy settings object.
161 * @private
152 */ 162 */
153 createDefaultProxySettings_: function() { 163 createDefaultProxySettings_: function() {
154 return { 164 return {
155 Type: CrOnc.ProxySettingsType.DIRECT, 165 Type: CrOnc.ProxySettingsType.DIRECT,
156 ExcludeDomains: [], 166 ExcludeDomains: [],
157 Manual: { 167 Manual: {
158 HTTPProxy: {Host: '', Port: 80}, 168 HTTPProxy: {Host: '', Port: 80},
159 SecureHTTPProxy: {Host: '', Port: 80}, 169 SecureHTTPProxy: {Host: '', Port: 80},
160 FTPProxy: {Host: '', Port: 80}, 170 FTPProxy: {Host: '', Port: 80},
161 SOCKS: {Host: '', Port: 1080} 171 SOCKS: {Host: '', Port: 1080}
162 }, 172 },
163 PAC: '' 173 PAC: ''
164 }; 174 };
165 }, 175 },
166 176
167 /** 177 /**
168 * Polymer useSameProxy changed method.
169 */
170 useSameProxyChanged_: function() {
171 this.sendProxyChange_();
172 },
173
174 /**
175 * Called when the proxy changes in the UI. 178 * Called when the proxy changes in the UI.
179 * @private
176 */ 180 */
177 sendProxyChange_: function() { 181 sendProxyChange_: function() {
178 if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) { 182 if (this.proxy.Type == CrOnc.ProxySettingsType.MANUAL) {
179 var proxy = 183 var proxy =
180 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy)); 184 /** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy));
181 var defaultProxy = proxy.Manual.HTTPProxy; 185 var defaultProxy = proxy.Manual.HTTPProxy;
182 if (!defaultProxy || !defaultProxy.Host) 186 if (!defaultProxy || !defaultProxy.Host)
183 return; 187 return;
184 if (this.useSameProxy_ || !proxy.Manual.SecureHTTPProxy) { 188 if (this.useSameProxy_ || !proxy.Manual.SecureHTTPProxy) {
185 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ ( 189 proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ (
(...skipping 12 matching lines...) Expand all
198 this.proxy = proxy; 202 this.proxy = proxy;
199 } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) { 203 } else if (this.proxy.Type == CrOnc.ProxySettingsType.PAC) {
200 if (!this.proxy.PAC) 204 if (!this.proxy.PAC)
201 return; 205 return;
202 } 206 }
203 this.fire('proxy-change', {field: 'ProxySettings', value: this.proxy}); 207 this.fire('proxy-change', {field: 'ProxySettings', value: this.proxy});
204 }, 208 },
205 209
206 /** 210 /**
207 * Event triggered when the selected proxy type changes. 211 * Event triggered when the selected proxy type changes.
208 * @param {!{detail: !{selected: string}}} e 212 * @param {!{target: !{value: string}}} e
209 * @private 213 * @private
210 */ 214 */
211 onTypeChange_: function(e) { 215 onTypeChange_: function(e) {
212 var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ ( 216 var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ (
213 e.detail.selected); 217 e.target.value);
214 this.set('proxy.Type', type); 218 this.set('proxy.Type', type);
215 this.sendProxyChange_(); 219 this.sendProxyChange_();
216 }, 220 },
217 221
218 /** 222 /**
219 * Event triggered when a proxy value changes. 223 * Event triggered when a proxy value changes.
220 * @param {Event} event The proxy value change event. 224 * @param {Event} event The proxy value change event.
221 * @private 225 * @private
222 */ 226 */
223 onProxyInputChange_: function(event) { 227 onProxyInputChange_: function(event) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 /** 286 /**
283 * @param {string} property The property to test 287 * @param {string} property The property to test
284 * @param {string} value The value to test against 288 * @param {string} value The value to test against
285 * @return {boolean} True if property == value 289 * @return {boolean} True if property == value
286 * @private 290 * @private
287 */ 291 */
288 matches_: function(property, value) { 292 matches_: function(property, value) {
289 return property == value; 293 return property == value;
290 } 294 }
291 }); 295 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698