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

Side by Side Diff: chrome/browser/resources/options/chromeos/internet_detail.js

Issue 543493002: Compile chrome://settings, part 2: reduce from 950 to 400 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@F_settings
Patch Set: fixed all but one comment (website_settings.js:42 left) Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (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
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_(parseQueryParams(window.location));
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.
250 * @param {Object} params
109 */ 251 */
110 showNetworkDetails_: function(params) { 252 showNetworkDetails_: function(params) {
Dan Beam 2014/09/09 02:59:09 remove |params| and instead: var params = parseQu
Vitaly Pavlenko 2014/09/09 17:54:51 Even "var params" can be inlined, is it ok?
111 var servicePath = params.servicePath; 253 var servicePath = params.servicePath;
112 if (!servicePath || !servicePath.length) 254 if (!servicePath || !servicePath.length)
113 return; 255 return;
114 var networkType = ''; // ignored for 'options' 256 var networkType = ''; // ignored for 'options'
115 chrome.send('networkCommand', [networkType, servicePath, 'options']); 257 chrome.send('networkCommand', [networkType, servicePath, 'options']);
116 }, 258 },
117 259
118 /** 260 /**
119 * Initializes the contents of the page. 261 * Initializes the contents of the page.
120 */ 262 */
121 initializePageContents_: function(params) { 263 initializePageContents_: function() {
122 $('details-internet-dismiss').addEventListener('click', function(event) { 264 $('details-internet-dismiss').addEventListener('click', function(event) {
123 DetailsInternetPage.setDetails(); 265 DetailsInternetPage.setDetails();
124 }); 266 });
125 267
126 $('details-internet-login').addEventListener('click', function(event) { 268 $('details-internet-login').addEventListener('click', function(event) {
127 DetailsInternetPage.setDetails(); 269 DetailsInternetPage.setDetails();
128 DetailsInternetPage.loginFromDetails(); 270 DetailsInternetPage.loginFromDetails();
129 }); 271 });
130 272
131 $('details-internet-disconnect').addEventListener('click', 273 $('details-internet-disconnect').addEventListener('click',
(...skipping 27 matching lines...) Expand all
159 $('cellular-apn-use-default').addEventListener('click', function(event) { 301 $('cellular-apn-use-default').addEventListener('click', function(event) {
160 var data = $('connection-state').data; 302 var data = $('connection-state').data;
161 var onc = $('connection-state').onc; 303 var onc = $('connection-state').onc;
162 var apnSelector = $('select-apn'); 304 var apnSelector = $('select-apn');
163 305
164 if (data.userApnIndex != -1) { 306 if (data.userApnIndex != -1) {
165 apnSelector.remove(data.userApnIndex); 307 apnSelector.remove(data.userApnIndex);
166 data.userApnIndex = -1; 308 data.userApnIndex = -1;
167 } 309 }
168 310
169 var activeApn; 311 var activeApn = {};
170 var iApn = -1; 312 var iApn = -1;
171 var apnList = onc.getActiveValue('Cellular.APNList'); 313 var apnList = onc.getActiveValue('Cellular.APNList');
172 if (apnList != undefined && apnList.length > 0) { 314 if (apnList != undefined && apnList.length > 0) {
173 iApn = 0; 315 iApn = 0;
174 var defaultApn = apnList[iApn]; 316 var defaultApn = apnList[iApn];
175 activeApn['AccessPointName'] = 317 activeApn['AccessPointName'] =
176 stringFromValue(defaultApn['AccessPointName']); 318 stringFromValue(defaultApn['AccessPointName']);
177 activeApn['Username'] = stringFromValue(defaultApn['Username']); 319 activeApn['Username'] = stringFromValue(defaultApn['Username']);
178 activeApn['Password'] = stringFromValue(defaultApn['Password']); 320 activeApn['Password'] = stringFromValue(defaultApn['Password']);
179 chrome.send('setApn', [data.servicePath, 321 chrome.send('setApn', [data.servicePath,
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + 671 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() +
530 controlledBy.slice(1); 672 controlledBy.slice(1);
531 $('banner-text').textContent = loadTimeData.getString(bannerText); 673 $('banner-text').textContent = loadTimeData.getString(bannerText);
532 } 674 }
533 }, 675 },
534 676
535 /** 677 /**
536 * Handler for when the user clicks on the checkbox to allow a 678 * Handler for when the user clicks on the checkbox to allow a
537 * single proxy usage. 679 * single proxy usage.
538 * @private 680 * @private
539 * @param {Event} e Click Event.
540 */ 681 */
541 toggleSingleProxy_: function(e) { 682 toggleSingleProxy_: function() {
542 if ($('proxy-all-protocols').checked) { 683 if ($('proxy-all-protocols').checked) {
543 $('multi-proxy').hidden = true; 684 $('multi-proxy').hidden = true;
544 $('single-proxy').hidden = false; 685 $('single-proxy').hidden = false;
545 } else { 686 } else {
546 $('multi-proxy').hidden = false; 687 $('multi-proxy').hidden = false;
547 $('single-proxy').hidden = true; 688 $('single-proxy').hidden = true;
548 } 689 }
549 }, 690 },
550 691
551 /** 692 /**
552 * Handler for when the user clicks on the checkbox to enter 693 * Handler for when the user clicks on the checkbox to enter
553 * auto configuration URL. 694 * auto configuration URL.
554 * @private 695 * @private
555 * @param {Event} e Click Event.
556 */ 696 */
557 handleAutoConfigProxy_: function(e) { 697 handleAutoConfigProxy_: function() {
558 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; 698 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked;
559 }, 699 },
560 700
561 /** 701 /**
562 * Handler for selecting a radio button that will disable the manual 702 * Handler for selecting a radio button that will disable the manual
563 * controls. 703 * controls.
564 * @private 704 * @private
565 * @param {Event} e Click event.
566 */ 705 */
567 disableManualProxy_: function(e) { 706 disableManualProxy_: function(opt_e) {
568 $('ignored-host-list').disabled = true; 707 $('ignored-host-list').disabled = true;
569 $('new-host').disabled = true; 708 $('new-host').disabled = true;
570 $('remove-host').disabled = true; 709 $('remove-host').disabled = true;
571 $('add-host').disabled = true; 710 $('add-host').disabled = true;
572 $('proxy-all-protocols').disabled = true; 711 $('proxy-all-protocols').disabled = true;
573 $('proxy-host-name').disabled = true; 712 $('proxy-host-name').disabled = true;
574 $('proxy-host-port').disabled = true; 713 $('proxy-host-port').disabled = true;
575 $('proxy-host-single-name').disabled = true; 714 $('proxy-host-single-name').disabled = true;
576 $('proxy-host-single-port').disabled = true; 715 $('proxy-host-single-port').disabled = true;
577 $('secure-proxy-host-name').disabled = true; 716 $('secure-proxy-host-name').disabled = true;
578 $('secure-proxy-port').disabled = true; 717 $('secure-proxy-port').disabled = true;
579 $('ftp-proxy').disabled = true; 718 $('ftp-proxy').disabled = true;
580 $('ftp-proxy-port').disabled = true; 719 $('ftp-proxy-port').disabled = true;
581 $('socks-host').disabled = true; 720 $('socks-host').disabled = true;
582 $('socks-port').disabled = true; 721 $('socks-port').disabled = true;
583 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || 722 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled ||
584 !$('auto-proxy').checked; 723 !$('auto-proxy').checked;
585 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || 724 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled ||
586 !$('proxy-use-pac-url').checked; 725 !$('proxy-use-pac-url').checked;
587 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; 726 $('auto-proxy-parms').hidden = !$('auto-proxy').checked;
588 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; 727 $('manual-proxy-parms').hidden = !$('manual-proxy').checked;
589 chrome.send('coreOptionsUserMetricsAction', 728 chrome.send('coreOptionsUserMetricsAction',
590 ['Options_NetworkManualProxy_Disable']); 729 ['Options_NetworkManualProxy_Disable']);
591 }, 730 },
592 731
593 /** 732 /**
594 * Handler for selecting a radio button that will enable the manual 733 * Handler for selecting a radio button that will enable the manual
595 * controls. 734 * controls.
596 * @private 735 * @private
597 * @param {Event} e Click event.
598 */ 736 */
599 enableManualProxy_: function(e) { 737 enableManualProxy_: function(opt_e) {
600 $('ignored-host-list').redraw(); 738 $('ignored-host-list').redraw();
601 var allDisabled = $('manual-proxy').disabled; 739 var allDisabled = $('manual-proxy').disabled;
602 $('ignored-host-list').disabled = allDisabled; 740 $('ignored-host-list').disabled = allDisabled;
603 $('new-host').disabled = allDisabled; 741 $('new-host').disabled = allDisabled;
604 $('remove-host').disabled = allDisabled; 742 $('remove-host').disabled = allDisabled;
605 $('add-host').disabled = allDisabled; 743 $('add-host').disabled = allDisabled;
606 $('proxy-all-protocols').disabled = allDisabled; 744 $('proxy-all-protocols').disabled = allDisabled;
607 $('proxy-host-name').disabled = allDisabled; 745 $('proxy-host-name').disabled = allDisabled;
608 $('proxy-host-port').disabled = allDisabled; 746 $('proxy-host-port').disabled = allDisabled;
609 $('proxy-host-single-name').disabled = allDisabled; 747 $('proxy-host-single-name').disabled = allDisabled;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 if (data.type == 'Cellular') 900 if (data.type == 'Cellular')
763 chrome.send('networkCommand', [data.type, servicePath, 'activate']); 901 chrome.send('networkCommand', [data.type, servicePath, 'activate']);
764 PageManager.closeOverlay(); 902 PageManager.closeOverlay();
765 }; 903 };
766 904
767 DetailsInternetPage.setDetails = function() { 905 DetailsInternetPage.setDetails = function() {
768 var data = $('connection-state').data; 906 var data = $('connection-state').data;
769 var servicePath = data.servicePath; 907 var servicePath = data.servicePath;
770 if (data.type == 'WiFi') { 908 if (data.type == 'WiFi') {
771 sendCheckedIfEnabled(servicePath, 'setPreferNetwork', 909 sendCheckedIfEnabled(servicePath, 'setPreferNetwork',
772 $('prefer-network-wifi')); 910 assertInstanceof($('prefer-network-wifi'), HTMLInputElement));
773 sendCheckedIfEnabled(servicePath, 'setAutoConnect', 911 sendCheckedIfEnabled(servicePath, 'setAutoConnect',
774 $('auto-connect-network-wifi')); 912 assertInstanceof($('auto-connect-network-wifi'), HTMLInputElement));
775 } else if (data.type == 'Wimax') { 913 } else if (data.type == 'Wimax') {
776 sendCheckedIfEnabled(servicePath, 'setAutoConnect', 914 sendCheckedIfEnabled(servicePath, 'setAutoConnect',
777 $('auto-connect-network-wimax')); 915 assertInstanceof($('auto-connect-network-wimax'), HTMLInputElement));
778 } else if (data.type == 'Cellular') { 916 } else if (data.type == 'Cellular') {
779 sendCheckedIfEnabled(servicePath, 'setAutoConnect', 917 sendCheckedIfEnabled(servicePath, 'setAutoConnect',
780 $('auto-connect-network-cellular')); 918 assertInstanceof($('auto-connect-network-cellular'),
919 HTMLInputElement));
781 } else if (data.type == 'VPN') { 920 } else if (data.type == 'VPN') {
782 chrome.send('setServerHostname', 921 chrome.send('setServerHostname',
783 [servicePath, 922 [servicePath,
784 $('inet-server-hostname').value]); 923 $('inet-server-hostname').value]);
785 sendCheckedIfEnabled(servicePath, 'setAutoConnect', 924 sendCheckedIfEnabled(servicePath, 'setAutoConnect',
786 $('auto-connect-network-vpn')); 925 assertInstanceof($('auto-connect-network-vpn'), HTMLInputElement));
787 } 926 }
788 927
789 var nameServerTypes = ['automatic', 'google', 'user']; 928 var nameServerTypes = ['automatic', 'google', 'user'];
790 var nameServerType = 'automatic'; 929 var nameServerType = 'automatic';
791 for (var i = 0; i < nameServerTypes.length; ++i) { 930 for (var i = 0; i < nameServerTypes.length; ++i) {
792 if ($(nameServerTypes[i] + '-dns-radio').checked) { 931 if ($(nameServerTypes[i] + '-dns-radio').checked) {
793 nameServerType = nameServerTypes[i]; 932 nameServerType = nameServerTypes[i];
794 break; 933 break;
795 } 934 }
796 } 935 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 1046
908 this.updateConnectionButtonVisibilty(onc); 1047 this.updateConnectionButtonVisibilty(onc);
909 1048
910 if (onc.type == 'WiFi') { 1049 if (onc.type == 'WiFi') {
911 $('wifi-connection-state').textContent = connectionStateString; 1050 $('wifi-connection-state').textContent = connectionStateString;
912 } else if (onc.type == 'Wimax') { 1051 } else if (onc.type == 'Wimax') {
913 $('wimax-connection-state').textContent = connectionStateString; 1052 $('wimax-connection-state').textContent = connectionStateString;
914 } else if (onc.type == 'Cellular') { 1053 } else if (onc.type == 'Cellular') {
915 $('activation-state').textContent = data.activationState; 1054 $('activation-state').textContent = data.activationState;
916 1055
917 $('buyplan-details').hidden = !data.showBuyButton; 1056 $('buyplan-details').hidden = true;
918 $('view-account-details').hidden = !data.showViewAccountButton; 1057 $('view-account-details').hidden = !data.showViewAccountButton;
919 1058
920 $('activate-details').hidden = !data.showActivateButton; 1059 $('activate-details').hidden = !data.showActivateButton;
921 if (data.showActivateButton) 1060 if (data.showActivateButton)
922 $('details-internet-login').hidden = true; 1061 $('details-internet-login').hidden = true;
923 1062
924 if (detailsPage.gsm) { 1063 if (detailsPage.gsm) {
925 var lockEnabled = 1064 var lockEnabled =
926 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); 1065 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
927 $('sim-card-lock-enabled').checked = lockEnabled; 1066 $('sim-card-lock-enabled').checked = lockEnabled;
928 $('change-pin').hidden = !lockEnabled; 1067 $('change-pin').hidden = !lockEnabled;
929 } 1068 }
930 } 1069 }
931 1070
932 $('connection-state').data = data; 1071 $('connection-state').data = data;
933 $('connection-state').onc = onc; 1072 $('connection-state').onc = onc;
934 }; 1073 };
935 1074
1075 /**
1076 * @param {InternetDetailedInfo} data
1077 */
936 DetailsInternetPage.showDetailedInfo = function(data) { 1078 DetailsInternetPage.showDetailedInfo = function(data) {
937 var detailsPage = DetailsInternetPage.getInstance(); 1079 var detailsPage = DetailsInternetPage.getInstance();
938 1080
939 var onc = new OncData(data); 1081 var onc = new OncData(data);
940 data.type = onc.type; 1082 data.type = onc.type;
941 1083
942 // Populate header 1084 // Populate header
943 $('network-details-title').textContent = onc.getTranslatedValue('Name'); 1085 $('network-details-title').textContent = onc.getTranslatedValue('Name');
944 var connectionState = onc.getActiveValue('ConnectionState'); 1086 var connectionState = onc.getActiveValue('ConnectionState');
945 var connectionStateString = onc.getTranslatedValue('ConnectionState'); 1087 var connectionStateString = onc.getTranslatedValue('ConnectionState');
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 updateHidden('.apn-details-view', true); 1412 updateHidden('.apn-details-view', true);
1271 var lockEnabled = 1413 var lockEnabled =
1272 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); 1414 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled');
1273 $('sim-card-lock-enabled').checked = lockEnabled; 1415 $('sim-card-lock-enabled').checked = lockEnabled;
1274 $('change-pin').hidden = !lockEnabled; 1416 $('change-pin').hidden = !lockEnabled;
1275 } 1417 }
1276 $('auto-connect-network-cellular').checked = 1418 $('auto-connect-network-cellular').checked =
1277 onc.getActiveValue('AutoConnect'); 1419 onc.getActiveValue('AutoConnect');
1278 $('auto-connect-network-cellular').disabled = false; 1420 $('auto-connect-network-cellular').disabled = false;
1279 1421
1280 $('buyplan-details').hidden = !data.showBuyButton; 1422 $('buyplan-details').hidden = true;
1281 $('view-account-details').hidden = !data.showViewAccountButton; 1423 $('view-account-details').hidden = !data.showViewAccountButton;
1282 $('activate-details').hidden = !data.showActivateButton; 1424 $('activate-details').hidden = !data.showActivateButton;
1283 if (data.showActivateButton) { 1425 if (data.showActivateButton) {
1284 $('details-internet-login').hidden = true; 1426 $('details-internet-login').hidden = true;
1285 } 1427 }
1286 } else if (onc.type == 'VPN') { 1428 } else if (onc.type == 'VPN') {
1287 OptionsPage.showTab($('vpn-nav-tab')); 1429 OptionsPage.showTab($('vpn-nav-tab'));
1288 detailsPage.gsm = false; 1430 detailsPage.gsm = false;
1289 $('inet-service-name').textContent = networkName; 1431 $('inet-service-name').textContent = networkName;
1290 $('inet-provider-type').textContent = 1432 $('inet-provider-type').textContent =
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 1483
1342 // Don't show page name in address bar and in history to prevent people 1484 // Don't show page name in address bar and in history to prevent people
1343 // navigate here by hand and solve issue with page session restore. 1485 // navigate here by hand and solve issue with page session restore.
1344 PageManager.showPageByName('detailsInternetPage', false); 1486 PageManager.showPageByName('detailsInternetPage', false);
1345 }; 1487 };
1346 1488
1347 return { 1489 return {
1348 DetailsInternetPage: DetailsInternetPage 1490 DetailsInternetPage: DetailsInternetPage
1349 }; 1491 };
1350 }); 1492 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698