OLD | NEW |
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 // require: onc_data.js | 5 // require: onc_data.js |
6 | 6 |
7 // NOTE(stevenjb): This code is in the process of being converted to be | 7 // NOTE(stevenjb): This code is in the process of being converted to be |
8 // compatible with the networkingPrivate extension API: | 8 // compatible with the networkingPrivate extension API: |
9 // * The network property dictionaries are being converted to use ONC values. | 9 // * The network property dictionaries are being converted to use ONC values. |
10 // * chrome.send calls will be replaced with an API object that simulates the | 10 // * chrome.send calls will be replaced with an API object that simulates the |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 event.value.controlledBy = 'policy'; | 436 event.value.controlledBy = 'policy'; |
437 } | 437 } |
438 | 438 |
439 return event; | 439 return event; |
440 }, | 440 }, |
441 | 441 |
442 /** | 442 /** |
443 * Update details page controls. | 443 * Update details page controls. |
444 */ | 444 */ |
445 updateControls: function() { | 445 updateControls: function() { |
| 446 // Note: onc may be undefined when called from a pref update before |
| 447 // initialized in sendNetworkDetails. |
446 var onc = this.onc_; | 448 var onc = this.onc_; |
447 if (onc == undefined) | |
448 return; // May get called from a pref update before initialized. | |
449 | 449 |
450 // Always show the ipconfig section. TODO(stevenjb): Improve the display | 450 // Always show the ipconfig section. TODO(stevenjb): Improve the display |
451 // for unconnected networks. Currently the IP address fields may be | 451 // for unconnected networks. Currently the IP address fields may be |
452 // blank if the network is not connected. | 452 // blank if the network is not connected. |
453 $('ipconfig-section').hidden = false; | 453 $('ipconfig-section').hidden = false; |
454 $('ipconfig-dns-section').hidden = false; | 454 $('ipconfig-dns-section').hidden = false; |
455 | 455 |
456 // Network type related. | 456 // Network type related. |
457 updateHidden('#details-internet-page .cellular-details', | 457 updateHidden('#details-internet-page .cellular-details', |
458 this.type_ != 'Cellular'); | 458 this.type_ != 'Cellular'); |
459 updateHidden('#details-internet-page .wifi-details', | 459 updateHidden('#details-internet-page .wifi-details', |
460 this.type_ != 'WiFi'); | 460 this.type_ != 'WiFi'); |
461 updateHidden('#details-internet-page .wimax-details', | 461 updateHidden('#details-internet-page .wimax-details', |
462 this.type_ != 'Wimax'); | 462 this.type_ != 'Wimax'); |
463 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); | 463 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); |
464 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); | 464 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); |
465 | 465 |
466 // Cellular | 466 // Cellular |
467 if (this.type_ == 'Cellular') { | 467 if (onc && this.type_ == 'Cellular') { |
468 // Hide gsm/cdma specific elements. | 468 // Hide gsm/cdma specific elements. |
469 if (onc.getActiveValue('Cellular.Family') == 'GSM') | 469 if (onc.getActiveValue('Cellular.Family') == 'GSM') |
470 updateHidden('#details-internet-page .cdma-only', true); | 470 updateHidden('#details-internet-page .cdma-only', true); |
471 else | 471 else |
472 updateHidden('#details-internet-page .gsm-only', true); | 472 updateHidden('#details-internet-page .gsm-only', true); |
473 } | 473 } |
474 | 474 |
475 // Wifi | 475 // Wifi |
476 | 476 |
477 // Hide network tab for VPN. | 477 // Hide network tab for VPN. |
478 updateHidden('#details-internet-page .network-details', | 478 updateHidden('#details-internet-page .network-details', |
479 this.type_ == 'VPN'); | 479 this.type_ == 'VPN'); |
480 | 480 |
481 // Password and shared. | 481 // Password and shared. |
482 var source = onc.getSource(); | 482 var source = onc ? onc.getSource() : 'None'; |
483 var shared = (source == 'Device' || source == 'DevicePolicy'); | 483 var shared = (source == 'Device' || source == 'DevicePolicy'); |
| 484 var security = onc ? onc.getWiFiSecurity() : 'None'; |
484 updateHidden('#details-internet-page #password-details', | 485 updateHidden('#details-internet-page #password-details', |
485 this.type_ != 'WiFi' || onc.getWiFiSecurity() == 'None'); | 486 this.type_ != 'WiFi' || security == 'None'); |
486 updateHidden('#details-internet-page #wifi-shared-network', !shared); | 487 updateHidden('#details-internet-page #wifi-shared-network', !shared); |
487 updateHidden('#details-internet-page #prefer-network', source == 'None'); | 488 updateHidden('#details-internet-page #prefer-network', source == 'None'); |
488 | 489 |
489 // WiMAX. | 490 // WiMAX. |
490 updateHidden('#details-internet-page #wimax-shared-network', !shared); | 491 updateHidden('#details-internet-page #wimax-shared-network', !shared); |
491 | 492 |
492 // Proxy | 493 // Proxy |
493 this.updateProxyBannerVisibility_(); | 494 this.updateProxyBannerVisibility_(); |
494 this.toggleSingleProxy_(); | 495 this.toggleSingleProxy_(); |
495 if ($('manual-proxy').checked) | 496 if ($('manual-proxy').checked) |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1589 |
1589 // Don't show page name in address bar and in history to prevent people | 1590 // Don't show page name in address bar and in history to prevent people |
1590 // navigate here by hand and solve issue with page session restore. | 1591 // navigate here by hand and solve issue with page session restore. |
1591 PageManager.showPageByName('detailsInternetPage', false); | 1592 PageManager.showPageByName('detailsInternetPage', false); |
1592 }; | 1593 }; |
1593 | 1594 |
1594 return { | 1595 return { |
1595 DetailsInternetPage: DetailsInternetPage | 1596 DetailsInternetPage: DetailsInternetPage |
1596 }; | 1597 }; |
1597 }); | 1598 }); |
OLD | NEW |