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

Side by Side Diff: chrome/browser/resources/options2/chromeos/internet_options.js

Issue 9668010: Move proxy handling into network details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 80-column wrap. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel; 7 const ArrayDataModel = cr.ui.ArrayDataModel;
8 8
9 ///////////////////////////////////////////////////////////////////////////// 9 /////////////////////////////////////////////////////////////////////////////
10 // InternetOptions class: 10 // InternetOptions class:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 this.showNetworkDetails_(); 75 this.showNetworkDetails_();
76 }, 76 },
77 77
78 showNetworkDetails_: function() { 78 showNetworkDetails_: function() {
79 var params = parseQueryParams(window.location); 79 var params = parseQueryParams(window.location);
80 var servicePath = params.servicePath; 80 var servicePath = params.servicePath;
81 var networkType = params.networkType; 81 var networkType = params.networkType;
82 if (!servicePath || !servicePath.length || 82 if (!servicePath || !servicePath.length ||
83 !networkType || !networkType.length) 83 !networkType || !networkType.length)
84 return; 84 return;
85 var networkName = params.networkName;
86 if (networkName)
87 options.ProxyOptions.getInstance().setNetworkName(networkName);
88 chrome.send('buttonClickCallback', 85 chrome.send('buttonClickCallback',
89 [networkType, servicePath, 'options']); 86 [networkType, servicePath, 'options']);
90 }, 87 },
91 88
92 updateHidden_: function(elements, hidden) { 89 updateHidden_: function(elements, hidden) {
93 for (var i = 0, el; el = elements[i]; i++) { 90 for (var i = 0, el; el = elements[i]; i++) {
94 el.hidden = hidden; 91 el.hidden = hidden;
95 } 92 }
96 }, 93 },
97 94
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 typeLabel.textContent = localStrings.getString(typeKey); 305 typeLabel.textContent = localStrings.getString(typeKey);
309 typeLabel.hidden = false; 306 typeLabel.hidden = false;
310 typeSeparator.hidden = false; 307 typeSeparator.hidden = false;
311 } else { 308 } else {
312 typeLabel.hidden = true; 309 typeLabel.hidden = true;
313 typeSeparator.hidden = true; 310 typeSeparator.hidden = true;
314 } 311 }
315 312
316 // TODO(chocobo): Is this hack to cache the data here reasonable? 313 // TODO(chocobo): Is this hack to cache the data here reasonable?
317 $('connectionState').data = data; 314 $('connectionState').data = data;
315
318 $('buyplanDetails').hidden = true; 316 $('buyplanDetails').hidden = true;
319 $('activateDetails').hidden = true; 317 $('activateDetails').hidden = true;
320 $('viewAccountDetails').hidden = true; 318 $('viewAccountDetails').hidden = true;
321 $('detailsInternetLogin').hidden = data.connected; 319 $('detailsInternetLogin').hidden = data.connected;
322 if (data.type == options.internet.Constants.TYPE_ETHERNET) 320 if (data.type == options.internet.Constants.TYPE_ETHERNET)
323 $('detailsInternetDisconnect').hidden = true; 321 $('detailsInternetDisconnect').hidden = true;
324 else 322 else
325 $('detailsInternetDisconnect').hidden = !data.connected; 323 $('detailsInternetDisconnect').hidden = !data.connected;
326 324
327 detailsPage.deviceConnected = data.deviceConnected; 325 detailsPage.deviceConnected = data.deviceConnected;
328 detailsPage.connecting = data.connecting; 326 detailsPage.connecting = data.connecting;
329 detailsPage.connected = data.connected; 327 detailsPage.connected = data.connected;
328 detailsPage.showProxy = data.showProxy;
330 $('connectionState').textContent = data.connectionState; 329 $('connectionState').textContent = data.connectionState;
331 330
332 var inetAddress = ''; 331 var inetAddress = '';
333 var inetSubnetAddress = ''; 332 var inetSubnetAddress = '';
334 var inetGateway = ''; 333 var inetGateway = '';
335 var inetDns = ''; 334 var inetDns = '';
336 $('ipTypeDHCP').checked = true; 335 $('ipTypeDHCP').checked = true;
337 if (data.ipconfigStatic.value) { 336 if (data.ipconfigStatic.value) {
338 inetAddress = data.ipconfigStatic.value.address; 337 inetAddress = data.ipconfigStatic.value.address;
339 inetSubnetAddress = data.ipconfigStatic.value.subnetAddress; 338 inetSubnetAddress = data.ipconfigStatic.value.subnetAddress;
340 inetGateway = data.ipconfigStatic.value.gateway; 339 inetGateway = data.ipconfigStatic.value.gateway;
341 inetDns = data.ipconfigStatic.value.dns; 340 inetDns = data.ipconfigStatic.value.dns;
342 $('ipTypeStatic').checked = true; 341 $('ipTypeStatic').checked = true;
343 } else if (data.ipconfigDHCP.value) { 342 } else if (data.ipconfigDHCP.value) {
344 inetAddress = data.ipconfigDHCP.value.address; 343 inetAddress = data.ipconfigDHCP.value.address;
345 inetSubnetAddress = data.ipconfigDHCP.value.subnetAddress; 344 inetSubnetAddress = data.ipconfigDHCP.value.subnetAddress;
346 inetGateway = data.ipconfigDHCP.value.gateway; 345 inetGateway = data.ipconfigDHCP.value.gateway;
347 inetDns = data.ipconfigDHCP.value.dns; 346 inetDns = data.ipconfigDHCP.value.dns;
348 } 347 }
349 348
350 // Hide the dhcp/static radio if needed. 349 // Hide the dhcp/static radio if needed.
351 $('ipTypeDHCPDiv').hidden = !data.showStaticIPConfig; 350 $('ipTypeDHCPDiv').hidden = !data.showStaticIPConfig;
352 $('ipTypeStaticDiv').hidden = !data.showStaticIPConfig; 351 $('ipTypeStaticDiv').hidden = !data.showStaticIPConfig;
353 352
354 // Hide change-proxy-button and change-proxy-section if not showing proxy.
355 $('change-proxy-button').hidden = !data.showProxy;
356 $('change-proxy-section').hidden = !data.showProxy;
357
358 var ipConfigList = $('ipConfigList'); 353 var ipConfigList = $('ipConfigList');
359 options.internet.IPConfigList.decorate(ipConfigList); 354 options.internet.IPConfigList.decorate(ipConfigList);
360 ipConfigList.disabled = 355 ipConfigList.disabled =
361 $('ipTypeDHCP').checked || data.ipconfigStatic.controlledBy || 356 $('ipTypeDHCP').checked || data.ipconfigStatic.controlledBy ||
362 !data.showStaticIPConfig; 357 !data.showStaticIPConfig;
363 ipConfigList.autoExpands = true; 358 ipConfigList.autoExpands = true;
364 var model = new ArrayDataModel([]); 359 var model = new ArrayDataModel([]);
365 model.push({ 360 model.push({
366 'property': 'inetAddress', 361 'property': 'inetAddress',
367 'name': localStrings.getString('inetAddress'), 362 'name': localStrings.getString('inetAddress'),
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 if (forElement) 570 if (forElement)
576 forElement.disabled = true; 571 forElement.disabled = true;
577 if (forElement.type == 'radio' && !forElement.checked) 572 if (forElement.type == 'radio' && !forElement.checked)
578 indicators[i].hidden = true; 573 indicators[i].hidden = true;
579 } else { 574 } else {
580 indicators[i].controlledBy = null; 575 indicators[i].controlledBy = null;
581 } 576 }
582 } 577 }
583 } 578 }
584 579
580 detailsPage.updateControls();
581
585 // Don't show page name in address bar and in history to prevent people 582 // Don't show page name in address bar and in history to prevent people
586 // navigate here by hand and solve issue with page session restore. 583 // navigate here by hand and solve issue with page session restore.
587 OptionsPage.showPageByName('detailsInternetPage', false); 584 OptionsPage.showPageByName('detailsInternetPage', false);
588 }; 585 };
589 586
590 InternetOptions.invalidNetworkSettings = function() { 587 InternetOptions.invalidNetworkSettings = function() {
591 alert(localStrings.getString('invalidNetworkSettings')); 588 alert(localStrings.getString('invalidNetworkSettings'));
592 }; 589 };
593 590
594 // Export 591 // Export
595 return { 592 return {
596 InternetOptions: InternetOptions 593 InternetOptions: InternetOptions
597 }; 594 };
598 }); 595 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/chromeos/internet_detail.js ('k') | chrome/browser/resources/options2/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698