| 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 |
| 11 // networkingPrivate API. See network_config.js. | 11 // networkingPrivate API. See network_config.js. |
| 12 // See crbug.com/279351 for more info. | 12 // See crbug.com/279351 for more info. |
| 13 | 13 |
| 14 /** @typedef {{activationState: (string|undefined), |
| 15 * carriers: Array, |
| 16 * currentCarrierIndex; (number|undefined), |
| 17 * ipAutoConfig: boolean, |
| 18 * ipconfig: Object, |
| 19 * nameServerType: string, |
| 20 * restrictedPool: (string|undefined), |
| 21 * roamingState: (string|undefined), |
| 22 * savedIP: Object, |
| 23 * showActivateButton: (boolean|undefined) |
| 24 * showViewAccountButton: (boolean|undefined), |
| 25 * staticIP: Object}} |
| 26 * Only the keys which had caused problems are declared in this typedef. |
| 27 * There are many more of them. |
| 28 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc |
| 29 */ |
| 30 var InternetDetailedInfo; |
| 31 |
| 14 cr.define('options.internet', function() { | 32 cr.define('options.internet', function() { |
| 15 var OncData = cr.onc.OncData; | 33 var OncData = cr.onc.OncData; |
| 16 var Page = cr.ui.pageManager.Page; | 34 var Page = cr.ui.pageManager.Page; |
| 17 var PageManager = cr.ui.pageManager.PageManager; | 35 var PageManager = cr.ui.pageManager.PageManager; |
| 18 /** @const */ var IPAddressField = options.internet.IPAddressField; | 36 /** @const */ var IPAddressField = options.internet.IPAddressField; |
| 19 | 37 |
| 38 var GetManagedTypes = { |
| 39 ACTIVE: 0, |
| 40 TRANSLATED: 1, |
| 41 RECOMMENDED: 2 |
| 42 }; |
| 43 |
| 44 /** |
| 45 * Gets the value of a property from a dictionary |data| that includes ONC |
| 46 * managed properties, e.g. getManagedValue(data, 'Name'). See notes for |
| 47 * getManagedProperty. |
| 48 * @param {Object} data The properties dictionary. |
| 49 * @param {string} key The property key. |
| 50 * @param {string=} opt_type The type of property to get as defined in |
| 51 * GetManagedTypes: |
| 52 * 'ACTIVE' (default) - gets the active value |
| 53 * 'TRANSLATED' - gets the traslated or active value |
| 54 * 'RECOMMENDED' - gets the recommended value |
| 55 * @return {*} The property value or undefined. |
| 56 */ |
| 57 function getManagedValue(data, key, opt_type) { |
| 58 var property = getManagedProperty(data, key); |
| 59 if (Array.isArray(property) || typeof property != 'object') |
| 60 return property; |
| 61 if (opt_type == GetManagedTypes.RECOMMENDED) |
| 62 return getRecommendedValue(property); |
| 63 if (opt_type == GetManagedTypes.TRANSLATED && 'Translated' in property) |
| 64 return property['Translated']; |
| 65 // Otherwise get the Active value (defalt behavior). |
| 66 if ('Active' in property) |
| 67 return property['Active']; |
| 68 // If no Active value is defined, return the effective value if present. |
| 69 var effective = getEffectiveValue(property); |
| 70 if (effective != undefined) |
| 71 return effective; |
| 72 // Otherwise this is an Object but not a Managed one. |
| 73 return property; |
| 74 } |
| 75 |
| 76 /** |
| 77 * Get the recommended value from a Managed property ONC dictionary. |
| 78 * @param {Object} property The managed property ONC dictionary. |
| 79 * @return {*} the effective value or undefined. |
| 80 */ |
| 81 function getRecommendedValue(property) { |
| 82 if (property['UserEditable']) |
| 83 return property['UserPolicy']; |
| 84 if (property['DeviceEditable']) |
| 85 return property['DevicePolicy']; |
| 86 // No value recommended by policy. |
| 87 return undefined; |
| 88 } |
| 89 |
| 90 /** |
| 91 * Get the effective value from a Managed property ONC dictionary. |
| 92 * @param {Object} property The managed property ONC dictionary. |
| 93 * @return {*} The effective value or undefined. |
| 94 */ |
| 95 function getEffectiveValue(property) { |
| 96 if ('Effective' in property) { |
| 97 var effective = property.Effective; |
| 98 if (effective in property) |
| 99 return property[effective]; |
| 100 } |
| 101 return undefined; |
| 102 } |
| 103 |
| 104 /** |
| 105 * Gets either a managed property dictionary or an unmanaged value from |
| 106 * dictionary |data| that includes ONC managed properties. This supports |
| 107 * nested dictionaries, e.g. getManagedProperty(data, 'VPN.Type'). |
| 108 * @param {Object} data The properties dictionary. |
| 109 * @param {string} key The property key. |
| 110 * @return {*} The property value or dictionary if it exists, otherwise |
| 111 * undefined. |
| 112 */ |
| 113 function getManagedProperty(data, key) { |
| 114 while (true) { |
| 115 var index = key.indexOf('.'); |
| 116 if (index < 0) |
| 117 break; |
| 118 var keyComponent = key.substr(0, index); |
| 119 if (!(keyComponent in data)) |
| 120 return undefined; |
| 121 data = data[keyComponent]; |
| 122 key = key.substr(index + 1); |
| 123 } |
| 124 return data[key]; |
| 125 } |
| 126 |
| 127 /** |
| 128 * Set the value of a property in dictionary |data| that includes ONC |
| 129 * managed properties, e.g. setManagedValue(data, 'Name', 'MyNetwork'). |
| 130 * See notes for getManagedProperty. |
| 131 * @param {Object} data The properties dictionary. |
| 132 * @param {string} key The property key. |
| 133 * @param {*} value The property value to set. |
| 134 */ |
| 135 function setManagedProperty(data, key, value) { |
| 136 while (true) { |
| 137 var index = key.indexOf('.'); |
| 138 if (index < 0) |
| 139 break; |
| 140 var keyComponent = key.substr(0, index); |
| 141 if (!(keyComponent in data)) |
| 142 data[keyComponent] = {}; |
| 143 data = data[keyComponent]; |
| 144 key = key.substr(index + 1); |
| 145 } |
| 146 if (!(key in data) || |
| 147 (typeof data[key] != 'object') || |
| 148 (!('Active' in data[key]) && !('Effective' in data[key]))) { |
| 149 data[key] = value; |
| 150 } else { |
| 151 var effective = data[key]['Effective']; |
| 152 assert(effective != 'UserPolicy' || data[key]['UserEditable']); |
| 153 assert(effective != 'DevicePolicy' || data[key]['DeviceEditable']); |
| 154 // For now, just uodare the active value. TODO(stevenjb): Eventually we |
| 155 // should update the 'UserSetting' and 'Effective' properties correctly |
| 156 // and send that back to Chrome. |
| 157 data[key]['Active'] = value; |
| 158 } |
| 159 } |
| 160 |
| 20 /** | 161 /** |
| 21 * Helper function to set hidden attribute for elements matching a selector. | 162 * Helper function to set hidden attribute for elements matching a selector. |
| 22 * @param {string} selector CSS selector for extracting a list of elements. | 163 * @param {string} selector CSS selector for extracting a list of elements. |
| 23 * @param {bool} hidden New hidden value. | 164 * @param {boolean} hidden New hidden value. |
| 24 */ | 165 */ |
| 25 function updateHidden(selector, hidden) { | 166 function updateHidden(selector, hidden) { |
| 26 var elements = cr.doc.querySelectorAll(selector); | 167 var elements = cr.doc.querySelectorAll(selector); |
| 27 for (var i = 0, el; el = elements[i]; i++) { | 168 for (var i = 0, el; el = elements[i]; i++) { |
| 28 el.hidden = hidden; | 169 el.hidden = hidden; |
| 29 } | 170 } |
| 30 } | 171 } |
| 31 | 172 |
| 32 /** | 173 /** |
| 33 * Helper function to update the properties of the data object from the | 174 * Helper function to update the properties of the data object from the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 * UI pref change handler. | 195 * UI pref change handler. |
| 55 * @param {Event} e The update event. | 196 * @param {Event} e The update event. |
| 56 */ | 197 */ |
| 57 function handlePrefUpdate(e) { | 198 function handlePrefUpdate(e) { |
| 58 DetailsInternetPage.getInstance().updateControls(); | 199 DetailsInternetPage.getInstance().updateControls(); |
| 59 } | 200 } |
| 60 | 201 |
| 61 /** | 202 /** |
| 62 * Simple helper method for converting a field to a string. It is used to | 203 * Simple helper method for converting a field to a string. It is used to |
| 63 * easily assign an empty string from fields that may be unknown or undefined. | 204 * easily assign an empty string from fields that may be unknown or undefined. |
| 64 * @param {object} value that should be converted to a string. | 205 * @param {Object} value that should be converted to a string. |
| 65 * @return {string} the result. | 206 * @return {string} the result. |
| 66 */ | 207 */ |
| 67 function stringFromValue(value) { | 208 function stringFromValue(value) { |
| 68 return value ? String(value) : ''; | 209 return value ? String(value) : ''; |
| 69 } | 210 } |
| 70 | 211 |
| 71 /** | 212 /** |
| 72 * Sends the 'checked' state of a control to chrome for a network. | 213 * Sends the 'checked' state of a control to chrome for a network. |
| 73 * @param {string} path The service path of the network. | 214 * @param {string} path The service path of the network. |
| 74 * @param {string} message The message to send to chrome. | 215 * @param {string} message The message to send to chrome. |
| 75 * @param {HTMLInputElement} checkbox The checkbox storing the value to send. | 216 * @param {HTMLInputElement} checkbox The checkbox storing the value to send. |
| 76 */ | 217 */ |
| 77 function sendCheckedIfEnabled(path, message, checkbox) { | 218 function sendCheckedIfEnabled(path, message, checkbox) { |
| 78 if (!checkbox.hidden && !checkbox.disabled) | 219 if (!checkbox.hidden && !checkbox.disabled) |
| 79 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); | 220 chrome.send(message, [path, checkbox.checked ? 'true' : 'false']); |
| 80 } | 221 } |
| 81 | 222 |
| 82 ///////////////////////////////////////////////////////////////////////////// | 223 ///////////////////////////////////////////////////////////////////////////// |
| 83 // DetailsInternetPage class: | 224 // DetailsInternetPage class: |
| 84 | 225 |
| 85 /** | 226 /** |
| 86 * Encapsulated handling of ChromeOS internet details overlay page. | 227 * Encapsulated handling of ChromeOS internet details overlay page. |
| 87 * @constructor | 228 * @constructor |
| 229 * @extends {cr.ui.pageManager.Page} |
| 88 */ | 230 */ |
| 89 function DetailsInternetPage() { | 231 function DetailsInternetPage() { |
| 90 Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); | 232 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); |
| 91 } | 233 } |
| 92 | 234 |
| 93 cr.addSingletonGetter(DetailsInternetPage); | 235 cr.addSingletonGetter(DetailsInternetPage); |
| 94 | 236 |
| 95 DetailsInternetPage.prototype = { | 237 DetailsInternetPage.prototype = { |
| 96 __proto__: Page.prototype, | 238 __proto__: Page.prototype, |
| 97 | 239 |
| 98 /** @override */ | 240 /** @override */ |
| 99 initializePage: function() { | 241 initializePage: function() { |
| 100 Page.prototype.initializePage.call(this); | 242 Page.prototype.initializePage.call(this); |
| 101 var params = parseQueryParams(window.location); | 243 this.initializePageContents_(); |
| 102 this.initializePageContents_(params); | 244 this.showNetworkDetails_(); |
| 103 this.showNetworkDetails_(params); | |
| 104 }, | 245 }, |
| 105 | 246 |
| 106 /** | 247 /** |
| 107 * Auto-activates the network details dialog if network information | 248 * Auto-activates the network details dialog if network information |
| 108 * is included in the URL. | 249 * is included in the URL. |
| 109 */ | 250 */ |
| 110 showNetworkDetails_: function(params) { | 251 showNetworkDetails_: function() { |
| 111 var servicePath = params.servicePath; | 252 var servicePath = parseQueryParams(window.location).servicePath; |
| 112 if (!servicePath || !servicePath.length) | 253 if (!servicePath || !servicePath.length) |
| 113 return; | 254 return; |
| 114 var networkType = ''; // ignored for 'options' | 255 var networkType = ''; // ignored for 'options' |
| 115 chrome.send('networkCommand', [networkType, servicePath, 'options']); | 256 chrome.send('networkCommand', [networkType, servicePath, 'options']); |
| 116 }, | 257 }, |
| 117 | 258 |
| 118 /** | 259 /** |
| 119 * Initializes the contents of the page. | 260 * Initializes the contents of the page. |
| 120 */ | 261 */ |
| 121 initializePageContents_: function(params) { | 262 initializePageContents_: function() { |
| 122 $('details-internet-dismiss').addEventListener('click', function(event) { | 263 $('details-internet-dismiss').addEventListener('click', function(event) { |
| 123 DetailsInternetPage.setDetails(); | 264 DetailsInternetPage.setDetails(); |
| 124 }); | 265 }); |
| 125 | 266 |
| 126 $('details-internet-login').addEventListener('click', function(event) { | 267 $('details-internet-login').addEventListener('click', function(event) { |
| 127 DetailsInternetPage.setDetails(); | 268 DetailsInternetPage.setDetails(); |
| 128 DetailsInternetPage.loginFromDetails(); | 269 DetailsInternetPage.loginFromDetails(); |
| 129 }); | 270 }); |
| 130 | 271 |
| 131 $('details-internet-disconnect').addEventListener('click', | 272 $('details-internet-disconnect').addEventListener('click', |
| (...skipping 27 matching lines...) Expand all Loading... |
| 159 $('cellular-apn-use-default').addEventListener('click', function(event) { | 300 $('cellular-apn-use-default').addEventListener('click', function(event) { |
| 160 var data = $('connection-state').data; | 301 var data = $('connection-state').data; |
| 161 var onc = $('connection-state').onc; | 302 var onc = $('connection-state').onc; |
| 162 var apnSelector = $('select-apn'); | 303 var apnSelector = $('select-apn'); |
| 163 | 304 |
| 164 if (data.userApnIndex != -1) { | 305 if (data.userApnIndex != -1) { |
| 165 apnSelector.remove(data.userApnIndex); | 306 apnSelector.remove(data.userApnIndex); |
| 166 data.userApnIndex = -1; | 307 data.userApnIndex = -1; |
| 167 } | 308 } |
| 168 | 309 |
| 169 var activeApn; | 310 var activeApn = {}; |
| 170 var iApn = -1; | 311 var iApn = -1; |
| 171 var apnList = onc.getActiveValue('Cellular.APNList'); | 312 var apnList = onc.getActiveValue('Cellular.APNList'); |
| 172 if (apnList != undefined && apnList.length > 0) { | 313 if (apnList != undefined && apnList.length > 0) { |
| 173 iApn = 0; | 314 iApn = 0; |
| 174 var defaultApn = apnList[iApn]; | 315 var defaultApn = apnList[iApn]; |
| 175 activeApn['AccessPointName'] = | 316 activeApn['AccessPointName'] = |
| 176 stringFromValue(defaultApn['AccessPointName']); | 317 stringFromValue(defaultApn['AccessPointName']); |
| 177 activeApn['Username'] = stringFromValue(defaultApn['Username']); | 318 activeApn['Username'] = stringFromValue(defaultApn['Username']); |
| 178 activeApn['Password'] = stringFromValue(defaultApn['Password']); | 319 activeApn['Password'] = stringFromValue(defaultApn['Password']); |
| 179 chrome.send('setApn', [data.servicePath, | 320 chrome.send('setApn', [data.servicePath, |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + | 670 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + |
| 530 controlledBy.slice(1); | 671 controlledBy.slice(1); |
| 531 $('banner-text').textContent = loadTimeData.getString(bannerText); | 672 $('banner-text').textContent = loadTimeData.getString(bannerText); |
| 532 } | 673 } |
| 533 }, | 674 }, |
| 534 | 675 |
| 535 /** | 676 /** |
| 536 * Handler for when the user clicks on the checkbox to allow a | 677 * Handler for when the user clicks on the checkbox to allow a |
| 537 * single proxy usage. | 678 * single proxy usage. |
| 538 * @private | 679 * @private |
| 539 * @param {Event} e Click Event. | |
| 540 */ | 680 */ |
| 541 toggleSingleProxy_: function(e) { | 681 toggleSingleProxy_: function() { |
| 542 if ($('proxy-all-protocols').checked) { | 682 if ($('proxy-all-protocols').checked) { |
| 543 $('multi-proxy').hidden = true; | 683 $('multi-proxy').hidden = true; |
| 544 $('single-proxy').hidden = false; | 684 $('single-proxy').hidden = false; |
| 545 } else { | 685 } else { |
| 546 $('multi-proxy').hidden = false; | 686 $('multi-proxy').hidden = false; |
| 547 $('single-proxy').hidden = true; | 687 $('single-proxy').hidden = true; |
| 548 } | 688 } |
| 549 }, | 689 }, |
| 550 | 690 |
| 551 /** | 691 /** |
| 552 * Handler for when the user clicks on the checkbox to enter | 692 * Handler for when the user clicks on the checkbox to enter |
| 553 * auto configuration URL. | 693 * auto configuration URL. |
| 554 * @private | 694 * @private |
| 555 * @param {Event} e Click Event. | |
| 556 */ | 695 */ |
| 557 handleAutoConfigProxy_: function(e) { | 696 handleAutoConfigProxy_: function() { |
| 558 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; | 697 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; |
| 559 }, | 698 }, |
| 560 | 699 |
| 561 /** | 700 /** |
| 562 * Handler for selecting a radio button that will disable the manual | 701 * Handler for selecting a radio button that will disable the manual |
| 563 * controls. | 702 * controls. |
| 564 * @private | 703 * @private |
| 565 * @param {Event} e Click event. | |
| 566 */ | 704 */ |
| 567 disableManualProxy_: function(e) { | 705 disableManualProxy_: function(opt_e) { |
| 568 $('ignored-host-list').disabled = true; | 706 $('ignored-host-list').disabled = true; |
| 569 $('new-host').disabled = true; | 707 $('new-host').disabled = true; |
| 570 $('remove-host').disabled = true; | 708 $('remove-host').disabled = true; |
| 571 $('add-host').disabled = true; | 709 $('add-host').disabled = true; |
| 572 $('proxy-all-protocols').disabled = true; | 710 $('proxy-all-protocols').disabled = true; |
| 573 $('proxy-host-name').disabled = true; | 711 $('proxy-host-name').disabled = true; |
| 574 $('proxy-host-port').disabled = true; | 712 $('proxy-host-port').disabled = true; |
| 575 $('proxy-host-single-name').disabled = true; | 713 $('proxy-host-single-name').disabled = true; |
| 576 $('proxy-host-single-port').disabled = true; | 714 $('proxy-host-single-port').disabled = true; |
| 577 $('secure-proxy-host-name').disabled = true; | 715 $('secure-proxy-host-name').disabled = true; |
| 578 $('secure-proxy-port').disabled = true; | 716 $('secure-proxy-port').disabled = true; |
| 579 $('ftp-proxy').disabled = true; | 717 $('ftp-proxy').disabled = true; |
| 580 $('ftp-proxy-port').disabled = true; | 718 $('ftp-proxy-port').disabled = true; |
| 581 $('socks-host').disabled = true; | 719 $('socks-host').disabled = true; |
| 582 $('socks-port').disabled = true; | 720 $('socks-port').disabled = true; |
| 583 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || | 721 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || |
| 584 !$('auto-proxy').checked; | 722 !$('auto-proxy').checked; |
| 585 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || | 723 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || |
| 586 !$('proxy-use-pac-url').checked; | 724 !$('proxy-use-pac-url').checked; |
| 587 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; | 725 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; |
| 588 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; | 726 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; |
| 589 chrome.send('coreOptionsUserMetricsAction', | 727 chrome.send('coreOptionsUserMetricsAction', |
| 590 ['Options_NetworkManualProxy_Disable']); | 728 ['Options_NetworkManualProxy_Disable']); |
| 591 }, | 729 }, |
| 592 | 730 |
| 593 /** | 731 /** |
| 594 * Handler for selecting a radio button that will enable the manual | 732 * Handler for selecting a radio button that will enable the manual |
| 595 * controls. | 733 * controls. |
| 596 * @private | 734 * @private |
| 597 * @param {Event} e Click event. | |
| 598 */ | 735 */ |
| 599 enableManualProxy_: function(e) { | 736 enableManualProxy_: function(opt_e) { |
| 600 $('ignored-host-list').redraw(); | 737 $('ignored-host-list').redraw(); |
| 601 var allDisabled = $('manual-proxy').disabled; | 738 var allDisabled = $('manual-proxy').disabled; |
| 602 $('ignored-host-list').disabled = allDisabled; | 739 $('ignored-host-list').disabled = allDisabled; |
| 603 $('new-host').disabled = allDisabled; | 740 $('new-host').disabled = allDisabled; |
| 604 $('remove-host').disabled = allDisabled; | 741 $('remove-host').disabled = allDisabled; |
| 605 $('add-host').disabled = allDisabled; | 742 $('add-host').disabled = allDisabled; |
| 606 $('proxy-all-protocols').disabled = allDisabled; | 743 $('proxy-all-protocols').disabled = allDisabled; |
| 607 $('proxy-host-name').disabled = allDisabled; | 744 $('proxy-host-name').disabled = allDisabled; |
| 608 $('proxy-host-port').disabled = allDisabled; | 745 $('proxy-host-port').disabled = allDisabled; |
| 609 $('proxy-host-single-name').disabled = allDisabled; | 746 $('proxy-host-single-name').disabled = allDisabled; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 if (data.type == 'Cellular') | 899 if (data.type == 'Cellular') |
| 763 chrome.send('networkCommand', [data.type, servicePath, 'activate']); | 900 chrome.send('networkCommand', [data.type, servicePath, 'activate']); |
| 764 PageManager.closeOverlay(); | 901 PageManager.closeOverlay(); |
| 765 }; | 902 }; |
| 766 | 903 |
| 767 DetailsInternetPage.setDetails = function() { | 904 DetailsInternetPage.setDetails = function() { |
| 768 var data = $('connection-state').data; | 905 var data = $('connection-state').data; |
| 769 var servicePath = data.servicePath; | 906 var servicePath = data.servicePath; |
| 770 if (data.type == 'WiFi') { | 907 if (data.type == 'WiFi') { |
| 771 sendCheckedIfEnabled(servicePath, 'setPreferNetwork', | 908 sendCheckedIfEnabled(servicePath, 'setPreferNetwork', |
| 772 $('prefer-network-wifi')); | 909 assertInstanceof($('prefer-network-wifi'), HTMLInputElement)); |
| 773 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 910 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
| 774 $('auto-connect-network-wifi')); | 911 assertInstanceof($('auto-connect-network-wifi'), HTMLInputElement)); |
| 775 } else if (data.type == 'Wimax') { | 912 } else if (data.type == 'Wimax') { |
| 776 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 913 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
| 777 $('auto-connect-network-wimax')); | 914 assertInstanceof($('auto-connect-network-wimax'), HTMLInputElement)); |
| 778 } else if (data.type == 'Cellular') { | 915 } else if (data.type == 'Cellular') { |
| 779 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 916 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
| 780 $('auto-connect-network-cellular')); | 917 assertInstanceof($('auto-connect-network-cellular'), |
| 918 HTMLInputElement)); |
| 781 } else if (data.type == 'VPN') { | 919 } else if (data.type == 'VPN') { |
| 782 chrome.send('setServerHostname', | 920 chrome.send('setServerHostname', |
| 783 [servicePath, | 921 [servicePath, |
| 784 $('inet-server-hostname').value]); | 922 $('inet-server-hostname').value]); |
| 785 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 923 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
| 786 $('auto-connect-network-vpn')); | 924 assertInstanceof($('auto-connect-network-vpn'), HTMLInputElement)); |
| 787 } | 925 } |
| 788 | 926 |
| 789 var nameServerTypes = ['automatic', 'google', 'user']; | 927 var nameServerTypes = ['automatic', 'google', 'user']; |
| 790 var nameServerType = 'automatic'; | 928 var nameServerType = 'automatic'; |
| 791 for (var i = 0; i < nameServerTypes.length; ++i) { | 929 for (var i = 0; i < nameServerTypes.length; ++i) { |
| 792 if ($(nameServerTypes[i] + '-dns-radio').checked) { | 930 if ($(nameServerTypes[i] + '-dns-radio').checked) { |
| 793 nameServerType = nameServerTypes[i]; | 931 nameServerType = nameServerTypes[i]; |
| 794 break; | 932 break; |
| 795 } | 933 } |
| 796 } | 934 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | 1097 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
| 960 $('sim-card-lock-enabled').checked = lockEnabled; | 1098 $('sim-card-lock-enabled').checked = lockEnabled; |
| 961 $('change-pin').hidden = !lockEnabled; | 1099 $('change-pin').hidden = !lockEnabled; |
| 962 } | 1100 } |
| 963 } | 1101 } |
| 964 | 1102 |
| 965 $('connection-state').data = data; | 1103 $('connection-state').data = data; |
| 966 $('connection-state').onc = onc; | 1104 $('connection-state').onc = onc; |
| 967 }; | 1105 }; |
| 968 | 1106 |
| 1107 /** |
| 1108 * @param {InternetDetailedInfo} data |
| 1109 */ |
| 969 DetailsInternetPage.showDetailedInfo = function(data) { | 1110 DetailsInternetPage.showDetailedInfo = function(data) { |
| 970 var detailsPage = DetailsInternetPage.getInstance(); | 1111 var detailsPage = DetailsInternetPage.getInstance(); |
| 971 | 1112 |
| 972 var onc = new OncData(data); | 1113 var onc = new OncData(data); |
| 973 data.type = onc.type; | 1114 data.type = onc.type; |
| 974 | 1115 |
| 975 this.populateHeader(detailsPage, onc); | 1116 this.populateHeader(detailsPage, onc); |
| 976 | 1117 |
| 977 // TODO(stevenjb): Find a more appropriate place to cache data. | 1118 // TODO(stevenjb): Find a more appropriate place to cache data. |
| 978 $('connection-state').data = data; | 1119 $('connection-state').data = data; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 updateHidden('.apn-details-view', true); | 1420 updateHidden('.apn-details-view', true); |
| 1280 var lockEnabled = | 1421 var lockEnabled = |
| 1281 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | 1422 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
| 1282 $('sim-card-lock-enabled').checked = lockEnabled; | 1423 $('sim-card-lock-enabled').checked = lockEnabled; |
| 1283 $('change-pin').hidden = !lockEnabled; | 1424 $('change-pin').hidden = !lockEnabled; |
| 1284 } | 1425 } |
| 1285 $('auto-connect-network-cellular').checked = | 1426 $('auto-connect-network-cellular').checked = |
| 1286 onc.getActiveValue('AutoConnect'); | 1427 onc.getActiveValue('AutoConnect'); |
| 1287 $('auto-connect-network-cellular').disabled = false; | 1428 $('auto-connect-network-cellular').disabled = false; |
| 1288 | 1429 |
| 1289 $('buyplan-details').hidden = !data.showBuyButton; | 1430 $('buyplan-details').hidden = true; |
| 1290 $('view-account-details').hidden = !data.showViewAccountButton; | 1431 $('view-account-details').hidden = !data.showViewAccountButton; |
| 1291 $('activate-details').hidden = !data.showActivateButton; | 1432 $('activate-details').hidden = !data.showActivateButton; |
| 1292 if (data.showActivateButton) { | 1433 if (data.showActivateButton) { |
| 1293 $('details-internet-login').hidden = true; | 1434 $('details-internet-login').hidden = true; |
| 1294 } | 1435 } |
| 1295 } else if (onc.type == 'VPN') { | 1436 } else if (onc.type == 'VPN') { |
| 1296 OptionsPage.showTab($('vpn-nav-tab')); | 1437 OptionsPage.showTab($('vpn-nav-tab')); |
| 1297 detailsPage.gsm = false; | 1438 detailsPage.gsm = false; |
| 1298 $('inet-service-name').textContent = networkName; | 1439 $('inet-service-name').textContent = networkName; |
| 1299 $('inet-provider-type').textContent = | 1440 $('inet-provider-type').textContent = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 | 1491 |
| 1351 // Don't show page name in address bar and in history to prevent people | 1492 // Don't show page name in address bar and in history to prevent people |
| 1352 // navigate here by hand and solve issue with page session restore. | 1493 // navigate here by hand and solve issue with page session restore. |
| 1353 PageManager.showPageByName('detailsInternetPage', false); | 1494 PageManager.showPageByName('detailsInternetPage', false); |
| 1354 }; | 1495 }; |
| 1355 | 1496 |
| 1356 return { | 1497 return { |
| 1357 DetailsInternetPage: DetailsInternetPage | 1498 DetailsInternetPage: DetailsInternetPage |
| 1358 }; | 1499 }; |
| 1359 }); | 1500 }); |
| OLD | NEW |