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 chrome.networkingPrivate calls. | 10 // * chrome.send calls will be replaced with chrome.networkingPrivate calls. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 * @param {Array<string>} changes List of GUIDs whose properties have | 258 * @param {Array<string>} changes List of GUIDs whose properties have |
259 * changed. | 259 * changed. |
260 * @private | 260 * @private |
261 */ | 261 */ |
262 onNetworksChanged_: function(changes) { | 262 onNetworksChanged_: function(changes) { |
263 if (!this.onc_) | 263 if (!this.onc_) |
264 return; | 264 return; |
265 var guid = this.onc_.guid(); | 265 var guid = this.onc_.guid(); |
266 if (changes.indexOf(guid) != -1) { | 266 if (changes.indexOf(guid) != -1) { |
267 chrome.networkingPrivate.getManagedProperties( | 267 chrome.networkingPrivate.getManagedProperties( |
268 guid, DetailsInternetPage.updateConnectionData); | 268 guid, DetailsInternetPage.updateConnectionData); |
269 } | 269 } |
270 }, | 270 }, |
271 | 271 |
272 /** | 272 /** |
273 * Initializes the contents of the page. | 273 * Initializes the contents of the page. |
274 */ | 274 */ |
275 initializePageContents_: function() { | 275 initializePageContents_: function() { |
276 $('details-internet-dismiss').addEventListener('click', function(event) { | 276 $('details-internet-dismiss').addEventListener('click', function(event) { |
277 DetailsInternetPage.setDetails(); | 277 DetailsInternetPage.setDetails(); |
278 }); | 278 }); |
279 | 279 |
280 $('details-internet-login').addEventListener('click', function(event) { | 280 $('details-internet-login').addEventListener('click', function(event) { |
281 DetailsInternetPage.setDetails(); | 281 DetailsInternetPage.setDetails(); |
282 DetailsInternetPage.loginFromDetails(); | 282 DetailsInternetPage.loginFromDetails(); |
283 }); | 283 }); |
284 | 284 |
285 $('details-internet-disconnect').addEventListener('click', | 285 $('details-internet-disconnect') |
286 function(event) { | 286 .addEventListener('click', function(event) { |
287 DetailsInternetPage.setDetails(); | 287 DetailsInternetPage.setDetails(); |
288 DetailsInternetPage.disconnectNetwork(); | 288 DetailsInternetPage.disconnectNetwork(); |
289 }); | 289 }); |
290 | 290 |
291 $('details-internet-configure').addEventListener('click', | 291 $('details-internet-configure') |
292 function(event) { | 292 .addEventListener('click', function(event) { |
293 DetailsInternetPage.setDetails(); | 293 DetailsInternetPage.setDetails(); |
294 DetailsInternetPage.configureNetwork(); | 294 DetailsInternetPage.configureNetwork(); |
295 }); | 295 }); |
296 | 296 |
297 $('activate-details').addEventListener('click', function(event) { | 297 $('activate-details').addEventListener('click', function(event) { |
298 DetailsInternetPage.activateFromDetails(); | 298 DetailsInternetPage.activateFromDetails(); |
299 }); | 299 }); |
300 | 300 |
301 $('view-account-details').addEventListener('click', function(event) { | 301 $('view-account-details').addEventListener('click', function(event) { |
302 chrome.send('showMorePlanInfo', | 302 chrome.send( |
303 [DetailsInternetPage.getInstance().onc_.guid()]); | 303 'showMorePlanInfo', |
| 304 [DetailsInternetPage.getInstance().onc_.guid()]); |
304 PageManager.closeOverlay(); | 305 PageManager.closeOverlay(); |
305 }); | 306 }); |
306 | 307 |
307 $('cellular-apn-use-default').addEventListener('click', function(event) { | 308 $('cellular-apn-use-default').addEventListener('click', function(event) { |
308 DetailsInternetPage.getInstance().setDefaultApn_(); | 309 DetailsInternetPage.getInstance().setDefaultApn_(); |
309 }); | 310 }); |
310 | 311 |
311 $('cellular-apn-set').addEventListener('click', function(event) { | 312 $('cellular-apn-set').addEventListener('click', function(event) { |
312 DetailsInternetPage.getInstance().setApn_($('cellular-apn').value); | 313 DetailsInternetPage.getInstance().setApn_($('cellular-apn').value); |
313 }); | 314 }); |
(...skipping 13 matching lines...) Expand all Loading... |
327 // we'll update UI to reflect that change. | 328 // we'll update UI to reflect that change. |
328 $('sim-card-lock-enabled').checked = !newValue; | 329 $('sim-card-lock-enabled').checked = !newValue; |
329 var operation = newValue ? 'setLocked' : 'setUnlocked'; | 330 var operation = newValue ? 'setLocked' : 'setUnlocked'; |
330 chrome.send('simOperation', [operation]); | 331 chrome.send('simOperation', [operation]); |
331 }); | 332 }); |
332 $('change-pin').addEventListener('click', function(event) { | 333 $('change-pin').addEventListener('click', function(event) { |
333 chrome.send('simOperation', ['changePin']); | 334 chrome.send('simOperation', ['changePin']); |
334 }); | 335 }); |
335 | 336 |
336 // Proxy | 337 // Proxy |
337 ['proxy-host-single-port', | 338 ['proxy-host-single-port', 'secure-proxy-port', 'socks-port', |
338 'secure-proxy-port', | 339 'ftp-proxy-port', 'proxy-host-port'] |
339 'socks-port', | 340 .forEach(function(id) { |
340 'ftp-proxy-port', | 341 options.PrefPortNumber.decorate($(id)); |
341 'proxy-host-port' | 342 }); |
342 ].forEach(function(id) { | |
343 options.PrefPortNumber.decorate($(id)); | |
344 }); | |
345 | 343 |
346 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); | 344 options.proxyexceptions.ProxyExceptions.decorate($('ignored-host-list')); |
347 $('remove-host').addEventListener('click', | 345 $('remove-host') |
348 this.handleRemoveProxyExceptions_); | 346 .addEventListener('click', this.handleRemoveProxyExceptions_); |
349 $('add-host').addEventListener('click', this.handleAddProxyException_); | 347 $('add-host').addEventListener('click', this.handleAddProxyException_); |
350 $('direct-proxy').addEventListener('click', this.disableManualProxy_); | 348 $('direct-proxy').addEventListener('click', this.disableManualProxy_); |
351 $('manual-proxy').addEventListener('click', this.enableManualProxy_); | 349 $('manual-proxy').addEventListener('click', this.enableManualProxy_); |
352 $('auto-proxy').addEventListener('click', this.disableManualProxy_); | 350 $('auto-proxy').addEventListener('click', this.disableManualProxy_); |
353 $('proxy-all-protocols').addEventListener('click', | 351 $('proxy-all-protocols') |
354 this.toggleSingleProxy_); | 352 .addEventListener('click', this.toggleSingleProxy_); |
355 $('proxy-use-pac-url').addEventListener('change', | 353 $('proxy-use-pac-url') |
356 this.handleAutoConfigProxy_); | 354 .addEventListener('change', this.handleAutoConfigProxy_); |
357 | 355 |
358 observePrefsUI($('direct-proxy')); | 356 observePrefsUI($('direct-proxy')); |
359 observePrefsUI($('manual-proxy')); | 357 observePrefsUI($('manual-proxy')); |
360 observePrefsUI($('auto-proxy')); | 358 observePrefsUI($('auto-proxy')); |
361 observePrefsUI($('proxy-all-protocols')); | 359 observePrefsUI($('proxy-all-protocols')); |
362 observePrefsUI($('proxy-use-pac-url')); | 360 observePrefsUI($('proxy-use-pac-url')); |
363 | 361 |
364 $('ip-automatic-configuration-checkbox').addEventListener('click', | 362 $('ip-automatic-configuration-checkbox') |
365 this.handleIpAutoConfig_); | 363 .addEventListener('click', this.handleIpAutoConfig_); |
366 $('automatic-dns-radio').addEventListener('click', | 364 $('automatic-dns-radio') |
367 this.handleNameServerTypeChange_); | 365 .addEventListener('click', this.handleNameServerTypeChange_); |
368 $('google-dns-radio').addEventListener('click', | 366 $('google-dns-radio') |
369 this.handleNameServerTypeChange_); | 367 .addEventListener('click', this.handleNameServerTypeChange_); |
370 $('user-dns-radio').addEventListener('click', | 368 $('user-dns-radio') |
371 this.handleNameServerTypeChange_); | 369 .addEventListener('click', this.handleNameServerTypeChange_); |
372 | 370 |
373 // We only load this string if we have the string data available | 371 // We only load this string if we have the string data available |
374 // because the proxy settings page on the login screen re-uses the | 372 // because the proxy settings page on the login screen re-uses the |
375 // proxy sub-page from the internet options, and it doesn't ever | 373 // proxy sub-page from the internet options, and it doesn't ever |
376 // show the DNS settings, so we don't need this string there. | 374 // show the DNS settings, so we don't need this string there. |
377 // The string isn't available because | 375 // The string isn't available because |
378 // chrome://settings-frame/strings.js (where the string is | 376 // chrome://settings-frame/strings.js (where the string is |
379 // stored) is not accessible from the login screen. | 377 // stored) is not accessible from the login screen. |
380 // TODO(pneubeck): Remove this once i18n of the proxy dialog on the login | 378 // TODO(pneubeck): Remove this once i18n of the proxy dialog on the login |
381 // page is fixed. http://crbug.com/242865 | 379 // page is fixed. http://crbug.com/242865 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 489 |
492 /** | 490 /** |
493 * Creates an indicator event for controlled properties using | 491 * Creates an indicator event for controlled properties using |
494 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. | 492 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. |
495 * @param {string} name The name for the Event. | 493 * @param {string} name The name for the Event. |
496 * @param {{value: *, controlledBy: *, recommendedValue: *}} propData | 494 * @param {{value: *, controlledBy: *, recommendedValue: *}} propData |
497 * Property dictionary. | 495 * Property dictionary. |
498 * @private | 496 * @private |
499 */ | 497 */ |
500 createControlledEvent_: function(name, propData) { | 498 createControlledEvent_: function(name, propData) { |
501 assert('value' in propData && 'controlledBy' in propData && | 499 assert( |
502 'recommendedValue' in propData); | 500 'value' in propData && 'controlledBy' in propData && |
| 501 'recommendedValue' in propData); |
503 var event = new Event(name); | 502 var event = new Event(name); |
504 event.value = { | 503 event.value = { |
505 value: propData.value, | 504 value: propData.value, |
506 controlledBy: propData.controlledBy, | 505 controlledBy: propData.controlledBy, |
507 recommendedValue: propData.recommendedValue | 506 recommendedValue: propData.recommendedValue |
508 }; | 507 }; |
509 return event; | 508 return event; |
510 }, | 509 }, |
511 | 510 |
512 /** | 511 /** |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // initialized in initializeDetailsPage. | 554 // initialized in initializeDetailsPage. |
556 var onc = this.onc_; | 555 var onc = this.onc_; |
557 | 556 |
558 // Always show the ipconfig section. TODO(stevenjb): Improve the display | 557 // Always show the ipconfig section. TODO(stevenjb): Improve the display |
559 // for unconnected networks. Currently the IP address fields may be | 558 // for unconnected networks. Currently the IP address fields may be |
560 // blank if the network is not connected. | 559 // blank if the network is not connected. |
561 $('ipconfig-section').hidden = false; | 560 $('ipconfig-section').hidden = false; |
562 $('ipconfig-dns-section').hidden = false; | 561 $('ipconfig-dns-section').hidden = false; |
563 | 562 |
564 // Network type related. | 563 // Network type related. |
565 updateHidden('#details-internet-page .cellular-details', | 564 updateHidden( |
566 this.type_ != 'Cellular'); | 565 '#details-internet-page .cellular-details', this.type_ != 'Cellular'); |
567 updateHidden('#details-internet-page .wifi-details', | 566 updateHidden( |
568 this.type_ != 'WiFi'); | 567 '#details-internet-page .wifi-details', this.type_ != 'WiFi'); |
569 updateHidden('#details-internet-page .wimax-details', | 568 updateHidden( |
570 this.type_ != 'WiMAX'); | 569 '#details-internet-page .wimax-details', this.type_ != 'WiMAX'); |
571 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); | 570 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); |
572 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); | 571 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); |
573 | 572 |
574 // Cellular | 573 // Cellular |
575 if (onc && this.type_ == 'Cellular') { | 574 if (onc && this.type_ == 'Cellular') { |
576 // Hide gsm/cdma specific elements. | 575 // Hide gsm/cdma specific elements. |
577 if (onc.getActiveValue('Cellular.Family') == 'GSM') | 576 if (onc.getActiveValue('Cellular.Family') == 'GSM') |
578 updateHidden('#details-internet-page .cdma-only', true); | 577 updateHidden('#details-internet-page .cdma-only', true); |
579 else | 578 else |
580 updateHidden('#details-internet-page .gsm-only', true); | 579 updateHidden('#details-internet-page .gsm-only', true); |
581 } | 580 } |
582 | 581 |
583 // Wifi | 582 // Wifi |
584 | 583 |
585 // Hide network tab for VPN. | 584 // Hide network tab for VPN. |
586 updateHidden('#details-internet-page .network-details', | 585 updateHidden( |
587 this.type_ == 'VPN'); | 586 '#details-internet-page .network-details', this.type_ == 'VPN'); |
588 | 587 |
589 // Password and shared. | 588 // Password and shared. |
590 var source = onc ? onc.getSource() : 'None'; | 589 var source = onc ? onc.getSource() : 'None'; |
591 var shared = (source == 'Device' || source == 'DevicePolicy'); | 590 var shared = (source == 'Device' || source == 'DevicePolicy'); |
592 var security = onc ? onc.getWiFiSecurity() : 'None'; | 591 var security = onc ? onc.getWiFiSecurity() : 'None'; |
593 updateHidden('#details-internet-page #password-details', | 592 updateHidden( |
594 this.type_ != 'WiFi' || security == 'None'); | 593 '#details-internet-page #password-details', |
| 594 this.type_ != 'WiFi' || security == 'None'); |
595 updateHidden('#details-internet-page #wifi-shared-network', !shared); | 595 updateHidden('#details-internet-page #wifi-shared-network', !shared); |
596 updateHidden('#details-internet-page #prefer-network', source == 'None'); | 596 updateHidden('#details-internet-page #prefer-network', source == 'None'); |
597 | 597 |
598 // WiMAX. | 598 // WiMAX. |
599 updateHidden('#details-internet-page #wimax-shared-network', !shared); | 599 updateHidden('#details-internet-page #wimax-shared-network', !shared); |
600 | 600 |
601 // Proxy | 601 // Proxy |
602 this.updateProxyBannerVisibility_(); | 602 this.updateProxyBannerVisibility_(); |
603 this.toggleSingleProxy_(); | 603 this.toggleSingleProxy_(); |
604 if ($('manual-proxy').checked) | 604 if ($('manual-proxy').checked) |
(...skipping 18 matching lines...) Expand all Loading... |
623 } | 623 } |
624 | 624 |
625 // Show banner and determine its message if necessary. | 625 // Show banner and determine its message if necessary. |
626 var controlledBy = $('direct-proxy').controlledBy; | 626 var controlledBy = $('direct-proxy').controlledBy; |
627 if (!controlledBy || controlledBy == '') { | 627 if (!controlledBy || controlledBy == '') { |
628 bannerDiv.hidden = true; | 628 bannerDiv.hidden = true; |
629 } else { | 629 } else { |
630 bannerDiv.hidden = false; | 630 bannerDiv.hidden = false; |
631 // The possible banner texts are loaded in proxy_handler.cc. | 631 // The possible banner texts are loaded in proxy_handler.cc. |
632 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + | 632 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + |
633 controlledBy.slice(1); | 633 controlledBy.slice(1); |
634 $('banner-text').textContent = loadTimeData.getString(bannerText); | 634 $('banner-text').textContent = loadTimeData.getString(bannerText); |
635 } | 635 } |
636 }, | 636 }, |
637 | 637 |
638 /** | 638 /** |
639 * Handler for when the user clicks on the checkbox to allow a | 639 * Handler for when the user clicks on the checkbox to allow a |
640 * single proxy usage. | 640 * single proxy usage. |
641 * @private | 641 * @private |
642 */ | 642 */ |
643 toggleSingleProxy_: function() { | 643 toggleSingleProxy_: function() { |
(...skipping 29 matching lines...) Expand all Loading... |
673 $('proxy-host-name').disabled = true; | 673 $('proxy-host-name').disabled = true; |
674 $('proxy-host-port').disabled = true; | 674 $('proxy-host-port').disabled = true; |
675 $('proxy-host-single-name').disabled = true; | 675 $('proxy-host-single-name').disabled = true; |
676 $('proxy-host-single-port').disabled = true; | 676 $('proxy-host-single-port').disabled = true; |
677 $('secure-proxy-host-name').disabled = true; | 677 $('secure-proxy-host-name').disabled = true; |
678 $('secure-proxy-port').disabled = true; | 678 $('secure-proxy-port').disabled = true; |
679 $('ftp-proxy').disabled = true; | 679 $('ftp-proxy').disabled = true; |
680 $('ftp-proxy-port').disabled = true; | 680 $('ftp-proxy-port').disabled = true; |
681 $('socks-host').disabled = true; | 681 $('socks-host').disabled = true; |
682 $('socks-port').disabled = true; | 682 $('socks-port').disabled = true; |
683 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || | 683 $('proxy-use-pac-url').disabled = |
684 !$('auto-proxy').checked; | 684 $('auto-proxy').disabled || !$('auto-proxy').checked; |
685 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || | 685 $('proxy-pac-url').disabled = |
686 !$('proxy-use-pac-url').checked; | 686 $('proxy-use-pac-url').disabled || !$('proxy-use-pac-url').checked; |
687 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; | 687 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; |
688 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; | 688 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; |
689 sendChromeMetricsAction('Options_NetworkManualProxy_Disable'); | 689 sendChromeMetricsAction('Options_NetworkManualProxy_Disable'); |
690 }, | 690 }, |
691 | 691 |
692 /** | 692 /** |
693 * Handler for selecting a radio button that will enable the manual | 693 * Handler for selecting a radio button that will enable the manual |
694 * controls. | 694 * controls. |
695 * @private | 695 * @private |
696 */ | 696 */ |
(...skipping 23 matching lines...) Expand all Loading... |
720 }, | 720 }, |
721 | 721 |
722 /** | 722 /** |
723 * Helper method called from initializeDetailsPage and updateConnectionData. | 723 * Helper method called from initializeDetailsPage and updateConnectionData. |
724 * Updates visibility/enabled of the login/disconnect/configure buttons. | 724 * Updates visibility/enabled of the login/disconnect/configure buttons. |
725 * @private | 725 * @private |
726 */ | 726 */ |
727 updateConnectionButtonVisibility_: function() { | 727 updateConnectionButtonVisibility_: function() { |
728 var onc = this.onc_; | 728 var onc = this.onc_; |
729 | 729 |
730 var prohibitedByPolicy = | 730 var prohibitedByPolicy = this.type_ == 'WiFi' && |
731 this.type_ == 'WiFi' && | |
732 loadTimeData.valueExists('allowOnlyPolicyNetworksToConnect') && | 731 loadTimeData.valueExists('allowOnlyPolicyNetworksToConnect') && |
733 loadTimeData.getBoolean('allowOnlyPolicyNetworksToConnect') && | 732 loadTimeData.getBoolean('allowOnlyPolicyNetworksToConnect') && |
734 (onc.data_.Source != 'DevicePolicy' && | 733 (onc.data_.Source != 'DevicePolicy' && |
735 onc.data_.Source != 'UserPolicy'); | 734 onc.data_.Source != 'UserPolicy'); |
736 | 735 |
737 if (this.type_ == 'Ethernet') { | 736 if (this.type_ == 'Ethernet') { |
738 // Ethernet can never be connected or disconnected and can always be | 737 // Ethernet can never be connected or disconnected and can always be |
739 // configured (e.g. to set security). | 738 // configured (e.g. to set security). |
740 $('details-internet-login').hidden = true; | 739 $('details-internet-login').hidden = true; |
741 $('details-internet-disconnect').hidden = true; | 740 $('details-internet-disconnect').hidden = true; |
742 $('details-internet-configure').hidden = false; | 741 $('details-internet-configure').hidden = false; |
743 return; | 742 return; |
744 } | 743 } |
745 | 744 |
746 var connectable = onc.getActiveValue('Connectable'); | 745 var connectable = onc.getActiveValue('Connectable'); |
747 var connectState = onc.getActiveValue('ConnectionState'); | 746 var connectState = onc.getActiveValue('ConnectionState'); |
748 if (connectState == 'NotConnected') { | 747 if (connectState == 'NotConnected') { |
749 $('details-internet-disconnect').hidden = true; | 748 $('details-internet-disconnect').hidden = true; |
750 $('details-internet-login').hidden = false; | 749 $('details-internet-login').hidden = false; |
751 // Connecting to an unconfigured network might trigger certificate | 750 // Connecting to an unconfigured network might trigger certificate |
752 // installation UI. Until that gets handled here, always enable the | 751 // installation UI. Until that gets handled here, always enable the |
753 // Connect button for built-in networks. | 752 // Connect button for built-in networks. |
754 var enabled = ((this.type_ != 'VPN') || | 753 var enabled = ((this.type_ != 'VPN') || |
755 (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') || | 754 (onc.getActiveValue('VPN.Type') != 'ThirdPartyVPN') || |
756 connectable) && !prohibitedByPolicy; | 755 connectable) && |
| 756 !prohibitedByPolicy; |
757 if (prohibitedByPolicy) { | 757 if (prohibitedByPolicy) { |
758 $('details-internet-login').setAttribute( | 758 $('details-internet-login') |
759 'title', loadTimeData.getString('prohibitedNetwork')); | 759 .setAttribute( |
| 760 'title', loadTimeData.getString('prohibitedNetwork')); |
760 } else { | 761 } else { |
761 $('details-internet-login').removeAttribute('title'); | 762 $('details-internet-login').removeAttribute('title'); |
762 } | 763 } |
763 $('details-internet-login').disabled = !enabled; | 764 $('details-internet-login').disabled = !enabled; |
764 } else { | 765 } else { |
765 $('details-internet-login').hidden = true; | 766 $('details-internet-login').hidden = true; |
766 $('details-internet-disconnect').hidden = false; | 767 $('details-internet-disconnect').hidden = false; |
767 } | 768 } |
768 | 769 |
769 var showConfigure = false; | 770 var showConfigure = false; |
770 if (this.type_ == 'VPN') { | 771 if (this.type_ == 'VPN') { |
771 showConfigure = true; | 772 showConfigure = true; |
772 } else if (this.type_ == 'WiMAX' && connectState == 'NotConnected') { | 773 } else if (this.type_ == 'WiMAX' && connectState == 'NotConnected') { |
773 showConfigure = true; | 774 showConfigure = true; |
774 } else if (this.type_ == 'WiFi') { | 775 } else if (this.type_ == 'WiFi') { |
775 showConfigure = (connectState == 'NotConnected' && | 776 showConfigure = |
776 (!connectable || onc.getWiFiSecurity() != 'None') && | 777 (connectState == 'NotConnected' && |
777 !prohibitedByPolicy); | 778 (!connectable || onc.getWiFiSecurity() != 'None') && |
| 779 !prohibitedByPolicy); |
778 } | 780 } |
779 $('details-internet-configure').hidden = !showConfigure; | 781 $('details-internet-configure').hidden = !showConfigure; |
780 }, | 782 }, |
781 | 783 |
782 /** | 784 /** |
783 * Helper method called from initializeDetailsPage and updateConnectionData. | 785 * Helper method called from initializeDetailsPage and updateConnectionData. |
784 * Updates the connection state property and account / sim card links. | 786 * Updates the connection state property and account / sim card links. |
785 * @private | 787 * @private |
786 */ | 788 */ |
787 updateDetails_: function() { | 789 updateDetails_: function() { |
(...skipping 13 matching lines...) Expand all Loading... |
801 $('activation-state').textContent = | 803 $('activation-state').textContent = |
802 onc.getTranslatedValue('Cellular.ActivationState'); | 804 onc.getTranslatedValue('Cellular.ActivationState'); |
803 if (onc.getActiveValue('Cellular.Family') == 'GSM') { | 805 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
804 var lockEnabled = | 806 var lockEnabled = |
805 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | 807 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
806 $('sim-card-lock-enabled').checked = lockEnabled; | 808 $('sim-card-lock-enabled').checked = lockEnabled; |
807 $('change-pin').hidden = !lockEnabled; | 809 $('change-pin').hidden = !lockEnabled; |
808 } | 810 } |
809 showViewAccount = shouldShowViewAccountButton(onc); | 811 showViewAccount = shouldShowViewAccountButton(onc); |
810 var activationState = onc.getActiveValue('Cellular.ActivationState'); | 812 var activationState = onc.getActiveValue('Cellular.ActivationState'); |
811 showActivate = (activationState == 'NotActivated' || | 813 showActivate = |
812 activationState == 'PartiallyActivated'); | 814 (activationState == 'NotActivated' || |
| 815 activationState == 'PartiallyActivated'); |
813 } | 816 } |
814 | 817 |
815 $('view-account-details').hidden = !showViewAccount; | 818 $('view-account-details').hidden = !showViewAccount; |
816 $('activate-details').hidden = !showActivate; | 819 $('activate-details').hidden = !showActivate; |
817 // If activation is not complete, hide the login button. | 820 // If activation is not complete, hide the login button. |
818 if (showActivate) | 821 if (showActivate) |
819 $('details-internet-login').hidden = true; | 822 $('details-internet-login').hidden = true; |
820 }, | 823 }, |
821 | 824 |
822 /** | 825 /** |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 /** | 930 /** |
928 * Helper method called from initializeDetailsPage to initialize the Apn | 931 * Helper method called from initializeDetailsPage to initialize the Apn |
929 * list. | 932 * list. |
930 * @private | 933 * @private |
931 */ | 934 */ |
932 initializeApnList_: function() { | 935 initializeApnList_: function() { |
933 this.selectedApnIndex_ = -1; | 936 this.selectedApnIndex_ = -1; |
934 this.userApnIndex_ = -1; | 937 this.userApnIndex_ = -1; |
935 | 938 |
936 var onc = this.onc_; | 939 var onc = this.onc_; |
937 var apnSelector = /** @type {HTMLSelectElement} */($('select-apn')); | 940 var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn')); |
938 | 941 |
939 // Clear APN lists, keep only last element, 'other'. | 942 // Clear APN lists, keep only last element, 'other'. |
940 while (apnSelector.length != 1) | 943 while (apnSelector.length != 1) |
941 apnSelector.remove(0); | 944 apnSelector.remove(0); |
942 | 945 |
943 var apnList = onc.getActiveValue('Cellular.APNList'); | 946 var apnList = onc.getActiveValue('Cellular.APNList'); |
944 if (apnList) { | 947 if (apnList) { |
945 // Populate the list with the existing APNs. | 948 // Populate the list with the existing APNs. |
946 this.populateApnList_(apnList); | 949 this.populateApnList_(apnList); |
947 } else { | 950 } else { |
948 // Create a single 'default' entry. | 951 // Create a single 'default' entry. |
949 var otherOption = apnSelector[0]; | 952 var otherOption = apnSelector[0]; |
950 var defaultOption = /** @type {HTMLElement} */( | 953 var defaultOption = |
951 document.createElement('option')); | 954 /** @type {HTMLElement} */ (document.createElement('option')); |
952 defaultOption.textContent = | 955 defaultOption.textContent = |
953 loadTimeData.getString('cellularApnUseDefault'); | 956 loadTimeData.getString('cellularApnUseDefault'); |
954 defaultOption.value = -1; | 957 defaultOption.value = -1; |
955 // Add 'default' entry before 'other' option | 958 // Add 'default' entry before 'other' option |
956 apnSelector.add(defaultOption, otherOption); | 959 apnSelector.add(defaultOption, otherOption); |
957 assert(apnSelector.length == 2); // 'default', 'other' | 960 assert(apnSelector.length == 2); // 'default', 'other' |
958 this.selectedApnIndex_ = 0; // Select 'default' | 961 this.selectedApnIndex_ = 0; // Select 'default' |
959 } | 962 } |
960 assert(this.selectedApnIndex_ >= 0); | 963 assert(this.selectedApnIndex_ >= 0); |
961 apnSelector.selectedIndex = this.selectedApnIndex_; | 964 apnSelector.selectedIndex = this.selectedApnIndex_; |
962 updateHidden('.apn-list-view', false); | 965 updateHidden('.apn-list-view', false); |
963 updateHidden('.apn-details-view', true); | 966 updateHidden('.apn-details-view', true); |
964 }, | 967 }, |
965 | 968 |
966 /** | 969 /** |
967 * Helper function for setting APN properties. | 970 * Helper function for setting APN properties. |
968 * @param {Object} apnValue Dictionary of APN properties. | 971 * @param {Object} apnValue Dictionary of APN properties. |
969 * @private | 972 * @private |
970 */ | 973 */ |
971 setActiveApn_: function(apnValue) { | 974 setActiveApn_: function(apnValue) { |
972 var activeApn = {}; | 975 var activeApn = {}; |
973 var apnName = apnValue['AccessPointName']; | 976 var apnName = apnValue['AccessPointName']; |
974 if (apnName) { | 977 if (apnName) { |
975 activeApn['AccessPointName'] = apnName; | 978 activeApn['AccessPointName'] = apnName; |
976 activeApn['Username'] = stringFromValue(apnValue['Username']); | 979 activeApn['Username'] = stringFromValue(apnValue['Username']); |
977 activeApn['Password'] = stringFromValue(apnValue['Password']); | 980 activeApn['Password'] = stringFromValue(apnValue['Password']); |
978 } | 981 } |
979 // Set the cached ONC data. | 982 // Set the cached ONC data. |
980 this.onc_.setProperty('Cellular.APN', activeApn); | 983 this.onc_.setProperty('Cellular.APN', activeApn); |
981 // Set an ONC object with just the APN values. | 984 // Set an ONC object with just the APN values. |
982 var oncData = new OncData({}); | 985 var oncData = new OncData({}); |
983 oncData.setProperty('Cellular.APN', activeApn); | 986 oncData.setProperty('Cellular.APN', activeApn); |
984 chrome.networkingPrivate.setProperties(this.onc_.guid(), | 987 chrome.networkingPrivate.setProperties( |
985 oncData.getData()); | 988 this.onc_.guid(), oncData.getData()); |
986 }, | 989 }, |
987 | 990 |
988 /** | 991 /** |
989 * Event Listener for the cellular-apn-use-default button. | 992 * Event Listener for the cellular-apn-use-default button. |
990 * @private | 993 * @private |
991 */ | 994 */ |
992 setDefaultApn_: function() { | 995 setDefaultApn_: function() { |
993 var apnSelector = /** @type {HTMLSelectElement} */($('select-apn')); | 996 var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn')); |
994 | 997 |
995 // Remove the 'user' entry if it exists. | 998 // Remove the 'user' entry if it exists. |
996 if (this.userApnIndex_ != -1) { | 999 if (this.userApnIndex_ != -1) { |
997 assert(this.userApnIndex_ < apnSelector.length - 1); | 1000 assert(this.userApnIndex_ < apnSelector.length - 1); |
998 apnSelector.remove(this.userApnIndex_); | 1001 apnSelector.remove(this.userApnIndex_); |
999 this.userApnIndex_ = -1; | 1002 this.userApnIndex_ = -1; |
1000 } | 1003 } |
1001 | 1004 |
1002 var apnList = this.onc_.getActiveValue('Cellular.APNList'); | 1005 var apnList = this.onc_.getActiveValue('Cellular.APNList'); |
1003 var iApn = (apnList != undefined && apnList.length > 0) ? 0 : -1; | 1006 var iApn = (apnList != undefined && apnList.length > 0) ? 0 : -1; |
1004 apnSelector.selectedIndex = iApn; | 1007 apnSelector.selectedIndex = iApn; |
1005 this.selectedApnIndex_ = iApn; | 1008 this.selectedApnIndex_ = iApn; |
1006 | 1009 |
1007 // Clear any user APN entry to inform Chrome to use the default APN. | 1010 // Clear any user APN entry to inform Chrome to use the default APN. |
1008 this.setActiveApn_({}); | 1011 this.setActiveApn_({}); |
1009 | 1012 |
1010 updateHidden('.apn-list-view', false); | 1013 updateHidden('.apn-list-view', false); |
1011 updateHidden('.apn-details-view', true); | 1014 updateHidden('.apn-details-view', true); |
1012 }, | 1015 }, |
1013 | 1016 |
1014 /** | 1017 /** |
1015 * Event Listener for the cellular-apn-set button. | 1018 * Event Listener for the cellular-apn-set button. |
1016 * @private | 1019 * @private |
1017 */ | 1020 */ |
1018 setApn_: function(apnValue) { | 1021 setApn_: function(apnValue) { |
1019 if (apnValue == '') | 1022 if (apnValue == '') |
1020 return; | 1023 return; |
1021 | 1024 |
1022 var apnSelector = /** @type {HTMLSelectElement} */($('select-apn')); | 1025 var apnSelector = /** @type {HTMLSelectElement} */ ($('select-apn')); |
1023 | 1026 |
1024 var activeApn = {}; | 1027 var activeApn = {}; |
1025 activeApn['AccessPointName'] = stringFromValue(apnValue); | 1028 activeApn['AccessPointName'] = stringFromValue(apnValue); |
1026 activeApn['Username'] = stringFromValue($('cellular-apn-username').value); | 1029 activeApn['Username'] = stringFromValue($('cellular-apn-username').value); |
1027 activeApn['Password'] = stringFromValue($('cellular-apn-password').value); | 1030 activeApn['Password'] = stringFromValue($('cellular-apn-password').value); |
1028 this.setActiveApn_(activeApn); | 1031 this.setActiveApn_(activeApn); |
1029 // Set the user selected APN. | 1032 // Set the user selected APN. |
1030 this.userApn_ = activeApn; | 1033 this.userApn_ = activeApn; |
1031 | 1034 |
1032 // Remove any existing 'user' entry. | 1035 // Remove any existing 'user' entry. |
(...skipping 11 matching lines...) Expand all Loading... |
1044 this.insertApnUserOption_(option); | 1047 this.insertApnUserOption_(option); |
1045 | 1048 |
1046 updateHidden('.apn-list-view', false); | 1049 updateHidden('.apn-list-view', false); |
1047 updateHidden('.apn-details-view', true); | 1050 updateHidden('.apn-details-view', true); |
1048 }, | 1051 }, |
1049 | 1052 |
1050 /** | 1053 /** |
1051 * Event Listener for the cellular-apn-cancel button. | 1054 * Event Listener for the cellular-apn-cancel button. |
1052 * @private | 1055 * @private |
1053 */ | 1056 */ |
1054 cancelApn_: function() { this.initializeApnList_(); }, | 1057 cancelApn_: function() { |
| 1058 this.initializeApnList_(); |
| 1059 }, |
1055 | 1060 |
1056 /** | 1061 /** |
1057 * Event Listener for the select-apn button. | 1062 * Event Listener for the select-apn button. |
1058 * @private | 1063 * @private |
1059 */ | 1064 */ |
1060 selectApn_: function() { | 1065 selectApn_: function() { |
1061 var onc = this.onc_; | 1066 var onc = this.onc_; |
1062 var apnSelector = $('select-apn'); | 1067 var apnSelector = $('select-apn'); |
1063 if (apnSelector[apnSelector.selectedIndex].value != -1) { | 1068 if (apnSelector[apnSelector.selectedIndex].value != -1) { |
1064 var apnList = onc.getActiveValue('Cellular.APNList'); | 1069 var apnList = onc.getActiveValue('Cellular.APNList'); |
1065 var apnIndex = apnSelector.selectedIndex; | 1070 var apnIndex = apnSelector.selectedIndex; |
1066 assert(apnIndex < apnList.length); | 1071 assert(apnIndex < apnList.length); |
1067 this.selectedApnIndex_ = apnIndex; | 1072 this.selectedApnIndex_ = apnIndex; |
1068 this.setActiveApn_(apnList[apnIndex]); | 1073 this.setActiveApn_(apnList[apnIndex]); |
1069 } else if (apnSelector.selectedIndex == this.userApnIndex_) { | 1074 } else if (apnSelector.selectedIndex == this.userApnIndex_) { |
1070 this.selectedApnIndex_ = apnSelector.selectedIndex; | 1075 this.selectedApnIndex_ = apnSelector.selectedIndex; |
1071 this.setActiveApn_(this.userApn_); | 1076 this.setActiveApn_(this.userApn_); |
1072 } else { // 'Other' | 1077 } else { // 'Other' |
1073 var apnDict; | 1078 var apnDict; |
1074 if (this.userApn_['AccessPointName']) { | 1079 if (this.userApn_['AccessPointName']) { |
1075 // Fill in the details fields with the existing 'user' config. | 1080 // Fill in the details fields with the existing 'user' config. |
1076 apnDict = this.userApn_; | 1081 apnDict = this.userApn_; |
1077 } else { | 1082 } else { |
1078 // No 'user' config, use the current values. | 1083 // No 'user' config, use the current values. |
1079 apnDict = {}; | 1084 apnDict = {}; |
1080 apnDict['AccessPointName'] = | 1085 apnDict['AccessPointName'] = |
1081 onc.getActiveValue('Cellular.APN.AccessPointName'); | 1086 onc.getActiveValue('Cellular.APN.AccessPointName'); |
1082 apnDict['Username'] = onc.getActiveValue('Cellular.APN.Username'); | 1087 apnDict['Username'] = onc.getActiveValue('Cellular.APN.Username'); |
1083 apnDict['Password'] = onc.getActiveValue('Cellular.APN.Password'); | 1088 apnDict['Password'] = onc.getActiveValue('Cellular.APN.Password'); |
1084 } | 1089 } |
1085 $('cellular-apn').value = stringFromValue(apnDict['AccessPointName']); | 1090 $('cellular-apn').value = stringFromValue(apnDict['AccessPointName']); |
1086 $('cellular-apn-username').value = stringFromValue(apnDict['Username']); | 1091 $('cellular-apn-username').value = stringFromValue(apnDict['Username']); |
1087 $('cellular-apn-password').value = stringFromValue(apnDict['Password']); | 1092 $('cellular-apn-password').value = stringFromValue(apnDict['Password']); |
1088 updateHidden('.apn-list-view', true); | 1093 updateHidden('.apn-list-view', true); |
1089 updateHidden('.apn-details-view', false); | 1094 updateHidden('.apn-details-view', false); |
1090 } | 1095 } |
1091 } | 1096 } |
1092 }; | 1097 }; |
1093 | 1098 |
1094 /** | 1099 /** |
1095 * Enables or Disables all buttons that provide operations on the cellular | 1100 * Enables or Disables all buttons that provide operations on the cellular |
1096 * network. | 1101 * network. |
1097 */ | 1102 */ |
1098 DetailsInternetPage.changeCellularButtonsState = function(disable) { | 1103 DetailsInternetPage.changeCellularButtonsState = function(disable) { |
1099 var buttonsToDisableList = | 1104 var buttonsToDisableList = new Array( |
1100 new Array('details-internet-login', | 1105 'details-internet-login', 'details-internet-disconnect', |
1101 'details-internet-disconnect', | 1106 'details-internet-configure', 'activate-details', |
1102 'details-internet-configure', | 1107 'view-account-details'); |
1103 'activate-details', | |
1104 'view-account-details'); | |
1105 | 1108 |
1106 for (var i = 0; i < buttonsToDisableList.length; ++i) { | 1109 for (var i = 0; i < buttonsToDisableList.length; ++i) { |
1107 var button = $(buttonsToDisableList[i]); | 1110 var button = $(buttonsToDisableList[i]); |
1108 button.disabled = disable; | 1111 button.disabled = disable; |
1109 } | 1112 } |
1110 }; | 1113 }; |
1111 | 1114 |
1112 /** | 1115 /** |
1113 * If the network is not already activated, starts the activation process or | 1116 * If the network is not already activated, starts the activation process or |
1114 * shows the activation UI. Otherwise does nothing. | 1117 * shows the activation UI. Otherwise does nothing. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 }; | 1159 }; |
1157 | 1160 |
1158 /** | 1161 /** |
1159 * Initializes even handling for keyboard driven flow. | 1162 * Initializes even handling for keyboard driven flow. |
1160 */ | 1163 */ |
1161 DetailsInternetPage.initializeKeyboardFlow = function() { | 1164 DetailsInternetPage.initializeKeyboardFlow = function() { |
1162 keyboard.initializeKeyboardFlow(false); | 1165 keyboard.initializeKeyboardFlow(false); |
1163 }; | 1166 }; |
1164 | 1167 |
1165 DetailsInternetPage.updateProxySettings = function(type) { | 1168 DetailsInternetPage.updateProxySettings = function(type) { |
1166 var proxyHost = null, | 1169 var proxyHost = null, proxyPort = null; |
1167 proxyPort = null; | |
1168 | 1170 |
1169 if (type == 'cros.session.proxy.singlehttp') { | 1171 if (type == 'cros.session.proxy.singlehttp') { |
1170 proxyHost = 'proxy-host-single-name'; | 1172 proxyHost = 'proxy-host-single-name'; |
1171 proxyPort = 'proxy-host-single-port'; | 1173 proxyPort = 'proxy-host-single-port'; |
1172 } else if (type == 'cros.session.proxy.httpurl') { | 1174 } else if (type == 'cros.session.proxy.httpurl') { |
1173 proxyHost = 'proxy-host-name'; | 1175 proxyHost = 'proxy-host-name'; |
1174 proxyPort = 'proxy-host-port'; | 1176 proxyPort = 'proxy-host-port'; |
1175 } else if (type == 'cros.session.proxy.httpsurl') { | 1177 } else if (type == 'cros.session.proxy.httpsurl') { |
1176 proxyHost = 'secure-proxy-host-name'; | 1178 proxyHost = 'secure-proxy-host-name'; |
1177 proxyPort = 'secure-proxy-port'; | 1179 proxyPort = 'secure-proxy-port'; |
1178 } else if (type == 'cros.session.proxy.ftpurl') { | 1180 } else if (type == 'cros.session.proxy.ftpurl') { |
1179 proxyHost = 'ftp-proxy'; | 1181 proxyHost = 'ftp-proxy'; |
1180 proxyPort = 'ftp-proxy-port'; | 1182 proxyPort = 'ftp-proxy-port'; |
1181 } else if (type == 'cros.session.proxy.socks') { | 1183 } else if (type == 'cros.session.proxy.socks') { |
1182 proxyHost = 'socks-host'; | 1184 proxyHost = 'socks-host'; |
1183 proxyPort = 'socks-port'; | 1185 proxyPort = 'socks-port'; |
1184 } else { | 1186 } else { |
1185 return; | 1187 return; |
| 1188 } |
| 1189 |
| 1190 var hostValue = $(proxyHost).value; |
| 1191 if (hostValue.indexOf(':') !== -1) { |
| 1192 if (hostValue.match(/:/g).length == 1) { |
| 1193 hostValue = hostValue.split(':'); |
| 1194 $(proxyHost).value = hostValue[0]; |
| 1195 $(proxyPort).value = hostValue[1]; |
1186 } | 1196 } |
1187 | 1197 } |
1188 var hostValue = $(proxyHost).value; | |
1189 if (hostValue.indexOf(':') !== -1) { | |
1190 if (hostValue.match(/:/g).length == 1) { | |
1191 hostValue = hostValue.split(':'); | |
1192 $(proxyHost).value = hostValue[0]; | |
1193 $(proxyPort).value = hostValue[1]; | |
1194 } | |
1195 } | |
1196 }; | 1198 }; |
1197 | 1199 |
1198 DetailsInternetPage.loginFromDetails = function() { | 1200 DetailsInternetPage.loginFromDetails = function() { |
1199 DetailsInternetPage.configureOrConnect(); | 1201 DetailsInternetPage.configureOrConnect(); |
1200 PageManager.closeOverlay(); | 1202 PageManager.closeOverlay(); |
1201 }; | 1203 }; |
1202 | 1204 |
1203 /** | 1205 /** |
1204 * This function identifies unconfigured networks and networks that are | 1206 * This function identifies unconfigured networks and networks that are |
1205 * likely to fail (e.g. due to a bad passphrase on a previous connect | 1207 * likely to fail (e.g. due to a bad passphrase on a previous connect |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 PageManager.closeOverlay(); | 1349 PageManager.closeOverlay(); |
1348 }; | 1350 }; |
1349 | 1351 |
1350 /** | 1352 /** |
1351 * Event handler called when the name server type changes. | 1353 * Event handler called when the name server type changes. |
1352 * @param {string} type The selected name sever type, 'automatic', 'google', | 1354 * @param {string} type The selected name sever type, 'automatic', 'google', |
1353 * or 'user'. | 1355 * or 'user'. |
1354 */ | 1356 */ |
1355 DetailsInternetPage.updateNameServerDisplay = function(type) { | 1357 DetailsInternetPage.updateNameServerDisplay = function(type) { |
1356 var editable = type == 'user'; | 1358 var editable = type == 'user'; |
1357 var fields = [$('ipconfig-dns1'), $('ipconfig-dns2'), | 1359 var fields = [ |
1358 $('ipconfig-dns3'), $('ipconfig-dns4')]; | 1360 $('ipconfig-dns1'), $('ipconfig-dns2'), $('ipconfig-dns3'), |
| 1361 $('ipconfig-dns4') |
| 1362 ]; |
1359 for (var i = 0; i < fields.length; ++i) { | 1363 for (var i = 0; i < fields.length; ++i) { |
1360 fields[i].editable = editable; | 1364 fields[i].editable = editable; |
1361 } | 1365 } |
1362 if (editable) | 1366 if (editable) |
1363 $('ipconfig-dns1').focus(); | 1367 $('ipconfig-dns1').focus(); |
1364 | 1368 |
1365 var automaticDns = $('automatic-dns-display'); | 1369 var automaticDns = $('automatic-dns-display'); |
1366 var googleDns = $('google-dns-display'); | 1370 var googleDns = $('google-dns-display'); |
1367 var userDns = $('user-dns-settings'); | 1371 var userDns = $('user-dns-settings'); |
1368 switch (type) { | 1372 switch (type) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 detailsPage.showProxy_ = true; | 1436 detailsPage.showProxy_ = true; |
1433 // Inform Chrome which network to use for proxy configuration. | 1437 // Inform Chrome which network to use for proxy configuration. |
1434 chrome.send('selectNetwork', [detailsPage.onc_.guid()]); | 1438 chrome.send('selectNetwork', [detailsPage.onc_.guid()]); |
1435 } else { | 1439 } else { |
1436 detailsPage.showProxy_ = false; | 1440 detailsPage.showProxy_ = false; |
1437 } | 1441 } |
1438 | 1442 |
1439 $('web-proxy-auto-discovery').hidden = true; | 1443 $('web-proxy-auto-discovery').hidden = true; |
1440 | 1444 |
1441 var restricted = onc.getActiveValue('RestrictedConnectivity'); | 1445 var restricted = onc.getActiveValue('RestrictedConnectivity'); |
1442 var restrictedString = loadTimeData.getString( | 1446 var restrictedString = |
1443 restricted ? 'restrictedYes' : 'restrictedNo'); | 1447 loadTimeData.getString(restricted ? 'restrictedYes' : 'restrictedNo'); |
1444 | 1448 |
1445 // These objects contain an 'automatic' property that is displayed when | 1449 // These objects contain an 'automatic' property that is displayed when |
1446 // ip-automatic-configuration-checkbox is checked, and a 'value' property | 1450 // ip-automatic-configuration-checkbox is checked, and a 'value' property |
1447 // that is displayed when unchecked and used to set the associated ONC | 1451 // that is displayed when unchecked and used to set the associated ONC |
1448 // property for StaticIPConfig on commit. | 1452 // property for StaticIPConfig on commit. |
1449 var inetAddress = {}; | 1453 var inetAddress = {}; |
1450 var inetNetmask = {}; | 1454 var inetNetmask = {}; |
1451 var inetGateway = {}; | 1455 var inetGateway = {}; |
1452 var ipv6Address = {}; | 1456 var ipv6Address = {}; |
1453 | 1457 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); | 1499 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); |
1496 if (savedIpAddress != undefined) { | 1500 if (savedIpAddress != undefined) { |
1497 inetAddress.automatic = savedIpAddress; | 1501 inetAddress.automatic = savedIpAddress; |
1498 if (!inetAddress.value) | 1502 if (!inetAddress.value) |
1499 inetAddress.value = savedIpAddress; | 1503 inetAddress.value = savedIpAddress; |
1500 } | 1504 } |
1501 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); | 1505 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); |
1502 if (savedPrefix != undefined) { | 1506 if (savedPrefix != undefined) { |
1503 assert(typeof savedPrefix == 'number'); | 1507 assert(typeof savedPrefix == 'number'); |
1504 var savedNetmask = prefixLengthToNetmask( | 1508 var savedNetmask = prefixLengthToNetmask( |
1505 /** @type {number} */(savedPrefix)); | 1509 /** @type {number} */ (savedPrefix)); |
1506 inetNetmask.automatic = savedNetmask; | 1510 inetNetmask.automatic = savedNetmask; |
1507 if (!inetNetmask.value) | 1511 if (!inetNetmask.value) |
1508 inetNetmask.value = savedNetmask; | 1512 inetNetmask.value = savedNetmask; |
1509 } | 1513 } |
1510 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); | 1514 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); |
1511 if (savedGateway != undefined) { | 1515 if (savedGateway != undefined) { |
1512 inetGateway.automatic = savedGateway; | 1516 inetGateway.automatic = savedGateway; |
1513 if (!inetGateway.value) | 1517 if (!inetGateway.value) |
1514 inetGateway.value = savedGateway; | 1518 inetGateway.value = savedGateway; |
1515 } | 1519 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 security = undefined; | 1649 security = undefined; |
1646 setOrHideParent('wifi-security', security); | 1650 setOrHideParent('wifi-security', security); |
1647 // Frequency is in MHz. | 1651 // Frequency is in MHz. |
1648 var frequency = onc.getActiveValue('WiFi.Frequency'); | 1652 var frequency = onc.getActiveValue('WiFi.Frequency'); |
1649 if (!frequency) | 1653 if (!frequency) |
1650 frequency = 0; | 1654 frequency = 0; |
1651 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); | 1655 var frequencyFormat = loadTimeData.getString('inetFrequencyFormat'); |
1652 frequencyFormat = frequencyFormat.replace('$1', frequency); | 1656 frequencyFormat = frequencyFormat.replace('$1', frequency); |
1653 $('wifi-frequency').textContent = frequencyFormat; | 1657 $('wifi-frequency').textContent = frequencyFormat; |
1654 $('wifi-signal-strength').textContent = strengthString; | 1658 $('wifi-signal-strength').textContent = strengthString; |
1655 setOrHideParent('wifi-hardware-address', | 1659 setOrHideParent( |
1656 onc.getActiveValue('MacAddress')); | 1660 'wifi-hardware-address', onc.getActiveValue('MacAddress')); |
1657 var priority = onc.getActiveValue('Priority'); | 1661 var priority = onc.getActiveValue('Priority'); |
1658 $('prefer-network-wifi').checked = priority > 0; | 1662 $('prefer-network-wifi').checked = priority > 0; |
1659 $('prefer-network-wifi').disabled = !remembered; | 1663 $('prefer-network-wifi').disabled = !remembered; |
1660 $('auto-connect-network-wifi').checked = | 1664 $('auto-connect-network-wifi').checked = |
1661 onc.getActiveValue('WiFi.AutoConnect'); | 1665 onc.getActiveValue('WiFi.AutoConnect'); |
1662 $('auto-connect-network-wifi').disabled = !remembered; | 1666 $('auto-connect-network-wifi').disabled = !remembered; |
1663 } else if (type == 'WiMAX') { | 1667 } else if (type == 'WiMAX') { |
1664 OptionsPage.showTab($('wimax-network-nav-tab')); | 1668 OptionsPage.showTab($('wimax-network-nav-tab')); |
1665 $('wimax-restricted-connectivity').textContent = restrictedString; | 1669 $('wimax-restricted-connectivity').textContent = restrictedString; |
1666 | 1670 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); | 1727 $('imsi').textContent = onc.getActiveValue('Cellular.IMSI'); |
1724 detailsPage.initializeApnList_(); | 1728 detailsPage.initializeApnList_(); |
1725 } | 1729 } |
1726 $('auto-connect-network-cellular').checked = | 1730 $('auto-connect-network-cellular').checked = |
1727 onc.getActiveValue('Cellular.AutoConnect'); | 1731 onc.getActiveValue('Cellular.AutoConnect'); |
1728 $('auto-connect-network-cellular').disabled = false; | 1732 $('auto-connect-network-cellular').disabled = false; |
1729 } else if (type == 'VPN') { | 1733 } else if (type == 'VPN') { |
1730 OptionsPage.showTab($('vpn-nav-tab')); | 1734 OptionsPage.showTab($('vpn-nav-tab')); |
1731 var providerType = onc.getActiveValue('VPN.Type'); | 1735 var providerType = onc.getActiveValue('VPN.Type'); |
1732 var isThirdPartyVPN = providerType == 'ThirdPartyVPN'; | 1736 var isThirdPartyVPN = providerType == 'ThirdPartyVPN'; |
1733 $('vpn-tab').classList.toggle('third-party-vpn-provider', | 1737 $('vpn-tab').classList.toggle( |
1734 isThirdPartyVPN); | 1738 'third-party-vpn-provider', isThirdPartyVPN); |
1735 | 1739 |
1736 $('inet-service-name').textContent = networkName; | 1740 $('inet-service-name').textContent = networkName; |
1737 $('inet-provider-type').textContent = | 1741 $('inet-provider-type').textContent = onc.getTranslatedValue('VPN.Type'); |
1738 onc.getTranslatedValue('VPN.Type'); | |
1739 | 1742 |
1740 if (isThirdPartyVPN) { | 1743 if (isThirdPartyVPN) { |
1741 $('inet-provider-name').textContent = | 1744 $('inet-provider-name').textContent = |
1742 onc.getActiveValue('VPN.ThirdPartyVPN.ProviderName'); | 1745 onc.getActiveValue('VPN.ThirdPartyVPN.ProviderName'); |
1743 } else { | 1746 } else { |
1744 var usernameKey; | 1747 var usernameKey; |
1745 if (providerType == 'OpenVPN') | 1748 if (providerType == 'OpenVPN') |
1746 usernameKey = 'VPN.OpenVPN.Username'; | 1749 usernameKey = 'VPN.OpenVPN.Username'; |
1747 else if (providerType == 'L2TP-IPsec') | 1750 else if (providerType == 'L2TP-IPsec') |
1748 usernameKey = 'VPN.L2TP.Username'; | 1751 usernameKey = 'VPN.L2TP.Username'; |
(...skipping 23 matching lines...) Expand all Loading... |
1772 // Update controlled option indicators. | 1775 // Update controlled option indicators. |
1773 var indicators = cr.doc.querySelectorAll( | 1776 var indicators = cr.doc.querySelectorAll( |
1774 '#details-internet-page .controlled-setting-indicator'); | 1777 '#details-internet-page .controlled-setting-indicator'); |
1775 for (var i = 0; i < indicators.length; i++) { | 1778 for (var i = 0; i < indicators.length; i++) { |
1776 var managed = indicators[i].hasAttribute('managed'); | 1779 var managed = indicators[i].hasAttribute('managed'); |
1777 // TODO(stevenjb): Eliminate support for 'data' once 39 is stable. | 1780 // TODO(stevenjb): Eliminate support for 'data' once 39 is stable. |
1778 var attributeName = managed ? 'managed' : 'data'; | 1781 var attributeName = managed ? 'managed' : 'data'; |
1779 var propName = indicators[i].getAttribute(attributeName); | 1782 var propName = indicators[i].getAttribute(attributeName); |
1780 if (!propName) | 1783 if (!propName) |
1781 continue; | 1784 continue; |
1782 var propValue = managed ? | 1785 var propValue = managed ? onc.getManagedProperty(propName) : |
1783 onc.getManagedProperty(propName) : | 1786 onc.getActiveValue(propName); |
1784 onc.getActiveValue(propName); | |
1785 // If the property is unset or unmanaged (i.e. not an Object) skip it. | 1787 // If the property is unset or unmanaged (i.e. not an Object) skip it. |
1786 if (propValue == undefined || (typeof propValue != 'object')) | 1788 if (propValue == undefined || (typeof propValue != 'object')) |
1787 continue; | 1789 continue; |
1788 var event; | 1790 var event; |
1789 if (managed) | 1791 if (managed) |
1790 event = detailsPage.createManagedEvent_(propName, propValue); | 1792 event = detailsPage.createManagedEvent_(propName, propValue); |
1791 else | 1793 else |
1792 event = detailsPage.createControlledEvent_(propName, | 1794 event = detailsPage.createControlledEvent_( |
1793 /** @type {{value: *, controlledBy: *, recommendedValue: *}} */( | 1795 propName, |
1794 propValue)); | 1796 /** @type {{value: *, controlledBy: *, recommendedValue: *}} */ |
| 1797 (propValue)); |
1795 indicators[i].handlePrefChange(event); | 1798 indicators[i].handlePrefChange(event); |
1796 var forElement = $(indicators[i].getAttribute('internet-detail-for')); | 1799 var forElement = $(indicators[i].getAttribute('internet-detail-for')); |
1797 if (forElement) { | 1800 if (forElement) { |
1798 if (event.value.controlledBy == 'policy') | 1801 if (event.value.controlledBy == 'policy') |
1799 forElement.disabled = true; | 1802 forElement.disabled = true; |
1800 if (forElement.resetHandler) | 1803 if (forElement.resetHandler) |
1801 indicators[i].resetHandler = forElement.resetHandler; | 1804 indicators[i].resetHandler = forElement.resetHandler; |
1802 } | 1805 } |
1803 } | 1806 } |
1804 | 1807 |
1805 detailsPage.updateControls(); | 1808 detailsPage.updateControls(); |
1806 | 1809 |
1807 // Don't show page name in address bar and in history to prevent people | 1810 // Don't show page name in address bar and in history to prevent people |
1808 // navigate here by hand and solve issue with page session restore. | 1811 // navigate here by hand and solve issue with page session restore. |
1809 PageManager.showPageByName('detailsInternetPage', false); | 1812 PageManager.showPageByName('detailsInternetPage', false); |
1810 }; | 1813 }; |
1811 | 1814 |
1812 return { | 1815 return {DetailsInternetPage: DetailsInternetPage}; |
1813 DetailsInternetPage: DetailsInternetPage | |
1814 }; | |
1815 }); | 1816 }); |
OLD | NEW |