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 // NOTE(stevenjb): This code is in the process of being converted to be | 5 // NOTE(stevenjb): This code is in the process of being converted to be |
6 // compatible with the networkingPrivate extension API: | 6 // compatible with the networkingPrivate extension API: |
7 // * The network property dictionaries are being converted to use ONC values. | 7 // * The network property dictionaries are being converted to use ONC values. |
8 // * chrome.send calls will be replaced with an API object that simulates the | 8 // * chrome.send calls will be replaced with an API object that simulates the |
9 // networkingPrivate API. See network_config.js. | 9 // networkingPrivate API. See network_config.js. |
10 // See crbug.com/279351 for more info. | 10 // See crbug.com/279351 for more info. |
11 | 11 |
12 /** @typedef {{activationState: (string|undefined), | |
13 * carriers: Array, | |
14 * currentCarrierIndex; (number|undefined), | |
15 * ipAutoConfig: boolean, | |
16 * ipconfig: Object, | |
17 * nameServerType: string, | |
18 * restrictedPool: (string|undefined), | |
19 * roamingState: (string|undefined), | |
20 * savedIP: Object, | |
21 * showActivateButton: (boolean|undefined) | |
22 * showViewAccountButton: (boolean|undefined), | |
23 * staticIP: Object}} | |
24 * Only the keys which had caused problems are declared in this typedef. | |
25 * There are many more of them. | |
26 * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc | |
27 */ | |
28 var InternetDetailedInfo; | |
29 | |
12 cr.define('options.internet', function() { | 30 cr.define('options.internet', function() { |
13 var Page = cr.ui.pageManager.Page; | 31 var Page = cr.ui.pageManager.Page; |
14 var PageManager = cr.ui.pageManager.PageManager; | 32 var PageManager = cr.ui.pageManager.PageManager; |
15 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 33 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
16 /** @const */ var IPAddressField = options.internet.IPAddressField; | 34 /** @const */ var IPAddressField = options.internet.IPAddressField; |
17 | 35 |
18 var GetManagedTypes = { | 36 var GetManagedTypes = { |
19 ACTIVE: 0, | 37 ACTIVE: 0, |
20 TRANSLATED: 1, | 38 TRANSLATED: 1, |
21 RECOMMENDED: 2 | 39 RECOMMENDED: 2 |
22 }; | 40 }; |
23 | 41 |
24 /** | 42 /** |
25 * Gets the value of a property from a dictionary |data| that includes ONC | 43 * Gets the value of a property from a dictionary |data| that includes ONC |
26 * managed properties, e.g. getManagedValue(data, 'Name'). See notes for | 44 * managed properties, e.g. getManagedValue(data, 'Name'). See notes for |
27 * getManagedProperty. | 45 * getManagedProperty. |
28 * @param {object} data The properties dictionary. | 46 * @param {Object} data The properties dictionary. |
29 * @param {string} key The property key. | 47 * @param {string} key The property key. |
30 * @param {string} type (Optional) The type of property to get as defined in | 48 * @param {string=} opt_type The type of property to get as defined in |
31 * GetManagedTypes: | 49 * GetManagedTypes: |
32 * 'ACTIVE' (default) - gets the active value | 50 * 'ACTIVE' (default) - gets the active value |
33 * 'TRANSLATED' - gets the traslated or active value | 51 * 'TRANSLATED' - gets the traslated or active value |
34 * 'RECOMMENDED' - gets the recommended value | 52 * 'RECOMMENDED' - gets the recommended value |
35 * @return {*} The property value or undefined. | 53 * @return {*} The property value or undefined. |
36 */ | 54 */ |
37 function getManagedValue(data, key, type) { | 55 function getManagedValue(data, key, opt_type) { |
38 var property = getManagedProperty(data, key); | 56 var property = getManagedProperty(data, key); |
39 if (Array.isArray(property) || typeof property != 'object') | 57 if (Array.isArray(property) || typeof property != 'object') |
40 return property; | 58 return property; |
41 if (type == GetManagedTypes.RECOMMENDED) | 59 if (opt_type == GetManagedTypes.RECOMMENDED) |
42 return getRecommendedValue(property); | 60 return getRecommendedValue(property); |
43 if (type == GetManagedTypes.TRANSLATED && 'Translated' in property) | 61 if (opt_type == GetManagedTypes.TRANSLATED && 'Translated' in property) |
44 return property['Translated']; | 62 return property['Translated']; |
45 // Otherwise get the Active value (defalt behavior). | 63 // Otherwise get the Active value (defalt behavior). |
46 if ('Active' in property) | 64 if ('Active' in property) |
47 return property['Active']; | 65 return property['Active']; |
48 // If no Active value is defined, return the effective value if present. | 66 // If no Active value is defined, return the effective value if present. |
49 var effective = getEffectiveValue(property); | 67 var effective = getEffectiveValue(property); |
50 if (effective != undefined) | 68 if (effective != undefined) |
51 return effective; | 69 return effective; |
52 // Otherwise this is an Object but not a Managed one. | 70 // Otherwise this is an Object but not a Managed one. |
53 return property; | 71 return property; |
54 } | 72 } |
55 | 73 |
56 /** | 74 /** |
57 * Get the recommended value from a Managed property ONC dictionary. | 75 * Get the recommended value from a Managed property ONC dictionary. |
58 * @param {object} property The managed property ONC dictionary. | 76 * @param {Object} property The managed property ONC dictionary. |
59 * @return {*} the effective value or undefined. | 77 * @return {*} the effective value or undefined. |
60 */ | 78 */ |
61 function getRecommendedValue(property) { | 79 function getRecommendedValue(property) { |
62 if (property['UserEditable']) | 80 if (property['UserEditable']) |
63 return property['UserPolicy']; | 81 return property['UserPolicy']; |
64 if (property['DeviceEditable']) | 82 if (property['DeviceEditable']) |
65 return property['DevicePolicy']; | 83 return property['DevicePolicy']; |
66 // No value recommended by policy. | 84 // No value recommended by policy. |
67 return undefined; | 85 return undefined; |
68 } | 86 } |
69 | 87 |
70 /** | 88 /** |
71 * Get the effective value from a Managed property ONC dictionary. | 89 * Get the effective value from a Managed property ONC dictionary. |
72 * @param {object} property The managed property ONC dictionary. | 90 * @param {Object} property The managed property ONC dictionary. |
73 * @return {*} The effective value or undefined. | 91 * @return {*} The effective value or undefined. |
74 */ | 92 */ |
75 function getEffectiveValue(property) { | 93 function getEffectiveValue(property) { |
76 if ('Effective' in property) { | 94 if ('Effective' in property) { |
77 var effective = property.Effective; | 95 var effective = property.Effective; |
78 if (effective in property) | 96 if (effective in property) |
79 return property[effective]; | 97 return property[effective]; |
80 } | 98 } |
81 return undefined; | 99 return undefined; |
82 } | 100 } |
83 | 101 |
84 /** | 102 /** |
85 * Gets either a managed property dictionary or an unmanaged value from | 103 * Gets either a managed property dictionary or an unmanaged value from |
86 * dictionary |data| that includes ONC managed properties. This supports | 104 * dictionary |data| that includes ONC managed properties. This supports |
87 * nested dictionaries, e.g. getManagedProperty(data, 'VPN.Type'). | 105 * nested dictionaries, e.g. getManagedProperty(data, 'VPN.Type'). |
88 * @param {object} data The properties dictionary. | 106 * @param {Object} data The properties dictionary. |
89 * @param {string} key The property key. | 107 * @param {string} key The property key. |
90 * @return {*} The property value or dictionary if it exists, otherwise | 108 * @return {*} The property value or dictionary if it exists, otherwise |
91 * undefined. | 109 * undefined. |
92 */ | 110 */ |
93 function getManagedProperty(data, key) { | 111 function getManagedProperty(data, key) { |
94 while (true) { | 112 while (true) { |
95 var index = key.indexOf('.'); | 113 var index = key.indexOf('.'); |
96 if (index < 0) | 114 if (index < 0) |
97 break; | 115 break; |
98 var keyComponent = key.substr(0, index); | 116 var keyComponent = key.substr(0, index); |
99 if (!(keyComponent in data)) | 117 if (!(keyComponent in data)) |
100 return undefined; | 118 return undefined; |
101 data = data[keyComponent]; | 119 data = data[keyComponent]; |
102 key = key.substr(index + 1); | 120 key = key.substr(index + 1); |
103 } | 121 } |
104 return data[key]; | 122 return data[key]; |
105 } | 123 } |
106 | 124 |
107 /** | 125 /** |
108 * Set the value of a property in dictionary |data| that includes ONC | 126 * Set the value of a property in dictionary |data| that includes ONC |
109 * managed properties, e.g. setManagedValue(data, 'Name', 'MyNetwork'). | 127 * managed properties, e.g. setManagedValue(data, 'Name', 'MyNetwork'). |
110 * See notes for getManagedProperty. | 128 * See notes for getManagedProperty. |
111 * @param {object} data The properties dictionary. | 129 * @param {Object} data The properties dictionary. |
112 * @param {string} key The property key. | 130 * @param {string} key The property key. |
113 * @param {string} value The property value to set. | 131 * @param {*} value The property value to set. |
114 */ | 132 */ |
115 function setManagedProperty(data, key, value) { | 133 function setManagedProperty(data, key, value) { |
116 while (true) { | 134 while (true) { |
117 var index = key.indexOf('.'); | 135 var index = key.indexOf('.'); |
118 if (index < 0) | 136 if (index < 0) |
119 break; | 137 break; |
120 var keyComponent = key.substr(0, index); | 138 var keyComponent = key.substr(0, index); |
121 if (!(keyComponent in data)) | 139 if (!(keyComponent in data)) |
122 data[keyComponent] = {}; | 140 data[keyComponent] = {}; |
123 data = data[keyComponent]; | 141 data = data[keyComponent]; |
(...skipping 10 matching lines...) Expand all Loading... | |
134 // For now, just uodare the active value. TODO(stevenjb): Eventually we | 152 // For now, just uodare the active value. TODO(stevenjb): Eventually we |
135 // should update the 'UserSetting' and 'Effective' properties correctly | 153 // should update the 'UserSetting' and 'Effective' properties correctly |
136 // and send that back to Chrome. | 154 // and send that back to Chrome. |
137 data[key]['Active'] = value; | 155 data[key]['Active'] = value; |
138 } | 156 } |
139 } | 157 } |
140 | 158 |
141 /** | 159 /** |
142 * Helper function to set hidden attribute for elements matching a selector. | 160 * Helper function to set hidden attribute for elements matching a selector. |
143 * @param {string} selector CSS selector for extracting a list of elements. | 161 * @param {string} selector CSS selector for extracting a list of elements. |
144 * @param {bool} hidden New hidden value. | 162 * @param {boolean} hidden New hidden value. |
145 */ | 163 */ |
146 function updateHidden(selector, hidden) { | 164 function updateHidden(selector, hidden) { |
147 var elements = cr.doc.querySelectorAll(selector); | 165 var elements = cr.doc.querySelectorAll(selector); |
148 for (var i = 0, el; el = elements[i]; i++) { | 166 for (var i = 0, el; el = elements[i]; i++) { |
149 el.hidden = hidden; | 167 el.hidden = hidden; |
150 } | 168 } |
151 } | 169 } |
152 | 170 |
153 /** | 171 /** |
154 * Helper function to update the properties of the data object from the | 172 * Helper function to update the properties of the data object from the |
(...skipping 20 matching lines...) Expand all Loading... | |
175 * UI pref change handler. | 193 * UI pref change handler. |
176 * @param {Event} e The update event. | 194 * @param {Event} e The update event. |
177 */ | 195 */ |
178 function handlePrefUpdate(e) { | 196 function handlePrefUpdate(e) { |
179 DetailsInternetPage.getInstance().updateControls(); | 197 DetailsInternetPage.getInstance().updateControls(); |
180 } | 198 } |
181 | 199 |
182 /** | 200 /** |
183 * Simple helper method for converting a field to a string. It is used to | 201 * Simple helper method for converting a field to a string. It is used to |
184 * easily assign an empty string from fields that may be unknown or undefined. | 202 * easily assign an empty string from fields that may be unknown or undefined. |
185 * @param {object} value that should be converted to a string. | 203 * @param {Object} value that should be converted to a string. |
186 * @return {string} the result. | 204 * @return {string} the result. |
187 */ | 205 */ |
188 function stringFromValue(value) { | 206 function stringFromValue(value) { |
189 return value ? String(value) : ''; | 207 return value ? String(value) : ''; |
190 } | 208 } |
191 | 209 |
192 /** | 210 /** |
193 * Sends the 'checked' state of a control to chrome for a network. | 211 * Sends the 'checked' state of a control to chrome for a network. |
194 * @param {string} path The service path of the network. | 212 * @param {string} path The service path of the network. |
195 * @param {string} message The message to send to chrome. | 213 * @param {string} message The message to send to chrome. |
(...skipping 27 matching lines...) Expand all Loading... | |
223 return loadTimeData.getString('ethernetName'); | 241 return loadTimeData.getString('ethernetName'); |
224 return getManagedValue(data, 'Name'); | 242 return getManagedValue(data, 'Name'); |
225 } | 243 } |
226 | 244 |
227 ///////////////////////////////////////////////////////////////////////////// | 245 ///////////////////////////////////////////////////////////////////////////// |
228 // DetailsInternetPage class: | 246 // DetailsInternetPage class: |
229 | 247 |
230 /** | 248 /** |
231 * Encapsulated handling of ChromeOS internet details overlay page. | 249 * Encapsulated handling of ChromeOS internet details overlay page. |
232 * @constructor | 250 * @constructor |
251 * @extends {cr.ui.pageManager.Page} | |
233 */ | 252 */ |
234 function DetailsInternetPage() { | 253 function DetailsInternetPage() { |
235 Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); | 254 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); |
236 } | 255 } |
237 | 256 |
238 cr.addSingletonGetter(DetailsInternetPage); | 257 cr.addSingletonGetter(DetailsInternetPage); |
239 | 258 |
240 DetailsInternetPage.prototype = { | 259 DetailsInternetPage.prototype = { |
241 __proto__: Page.prototype, | 260 __proto__: Page.prototype, |
242 | 261 |
243 /** @override */ | 262 /** @override */ |
244 initializePage: function() { | 263 initializePage: function() { |
245 Page.prototype.initializePage.call(this); | 264 Page.prototype.initializePage.call(this); |
246 var params = parseQueryParams(window.location); | 265 var params = parseQueryParams(window.location); |
Dan Beam
2014/09/06 02:22:36
^ can you just put this into showNetworkDetails_ n
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
Dan Beam
2014/09/09 02:59:09
i meant call parseQueryParams() inside showNetwork
Vitaly Pavlenko
2014/09/09 17:54:51
Done.
| |
247 this.initializePageContents_(params); | 266 this.initializePageContents_(); |
248 this.showNetworkDetails_(params); | 267 this.showNetworkDetails_(params); |
249 }, | 268 }, |
250 | 269 |
251 /** | 270 /** |
252 * Auto-activates the network details dialog if network information | 271 * Auto-activates the network details dialog if network information |
253 * is included in the URL. | 272 * is included in the URL. |
Dan Beam
2014/09/06 02:22:36
"@param {Object} params" missing
Vitaly Pavlenko
2014/09/06 22:54:07
Done.
| |
254 */ | 273 */ |
255 showNetworkDetails_: function(params) { | 274 showNetworkDetails_: function(params) { |
256 var servicePath = params.servicePath; | 275 var servicePath = params.servicePath; |
257 if (!servicePath || !servicePath.length) | 276 if (!servicePath || !servicePath.length) |
258 return; | 277 return; |
259 var networkType = ''; // ignored for 'options' | 278 var networkType = ''; // ignored for 'options' |
260 chrome.send('networkCommand', [networkType, servicePath, 'options']); | 279 chrome.send('networkCommand', [networkType, servicePath, 'options']); |
261 }, | 280 }, |
262 | 281 |
263 /** | 282 /** |
264 * Initializes the contents of the page. | 283 * Initializes the contents of the page. |
265 */ | 284 */ |
266 initializePageContents_: function(params) { | 285 initializePageContents_: function() { |
267 $('details-internet-dismiss').addEventListener('click', function(event) { | 286 $('details-internet-dismiss').addEventListener('click', function(event) { |
268 DetailsInternetPage.setDetails(); | 287 DetailsInternetPage.setDetails(); |
269 }); | 288 }); |
270 | 289 |
271 $('details-internet-login').addEventListener('click', function(event) { | 290 $('details-internet-login').addEventListener('click', function(event) { |
272 DetailsInternetPage.setDetails(); | 291 DetailsInternetPage.setDetails(); |
273 DetailsInternetPage.loginFromDetails(); | 292 DetailsInternetPage.loginFromDetails(); |
274 }); | 293 }); |
275 | 294 |
276 $('details-internet-disconnect').addEventListener('click', | 295 $('details-internet-disconnect').addEventListener('click', |
(...skipping 26 matching lines...) Expand all Loading... | |
303 | 322 |
304 $('cellular-apn-use-default').addEventListener('click', function(event) { | 323 $('cellular-apn-use-default').addEventListener('click', function(event) { |
305 var data = $('connection-state').data; | 324 var data = $('connection-state').data; |
306 var apnSelector = $('select-apn'); | 325 var apnSelector = $('select-apn'); |
307 | 326 |
308 if (data.userApnIndex != -1) { | 327 if (data.userApnIndex != -1) { |
309 apnSelector.remove(data.userApnIndex); | 328 apnSelector.remove(data.userApnIndex); |
310 data.userApnIndex = -1; | 329 data.userApnIndex = -1; |
311 } | 330 } |
312 | 331 |
313 var activeApn; | 332 var activeApn = {}; |
Dan Beam
2014/09/06 02:22:36
did this work before?
Vitaly Pavlenko
2014/09/06 22:54:07
Yes, and I don't know how. Should I contact the co
Dan Beam
2014/09/09 02:59:09
stevenjb@ said he's fixing this
Vitaly Pavlenko
2014/09/09 17:54:51
Acknowledged.
| |
314 var iApn = -1; | 333 var iApn = -1; |
315 var apnList = getManagedValue(data, 'Cellular.APNList'); | 334 var apnList = getManagedValue(data, 'Cellular.APNList'); |
316 if (apnList != undefined && apnList.length > 0) { | 335 if (apnList != undefined && apnList.length > 0) { |
317 iApn = 0; | 336 iApn = 0; |
318 var defaultApn = apnList[iApn]; | 337 var defaultApn = apnList[iApn]; |
319 activeApn['AccessPointName'] = | 338 activeApn['AccessPointName'] = |
320 stringFromValue(defaultApn['AccessPointName']); | 339 stringFromValue(defaultApn['AccessPointName']); |
321 activeApn['Username'] = stringFromValue(defaultApn['Username']); | 340 activeApn['Username'] = stringFromValue(defaultApn['Username']); |
322 activeApn['Password'] = stringFromValue(defaultApn['Password']); | 341 activeApn['Password'] = stringFromValue(defaultApn['Password']); |
323 chrome.send('setApn', [data.servicePath, | 342 chrome.send('setApn', [data.servicePath, |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
671 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + | 690 var bannerText = 'proxyBanner' + controlledBy.charAt(0).toUpperCase() + |
672 controlledBy.slice(1); | 691 controlledBy.slice(1); |
673 $('banner-text').textContent = loadTimeData.getString(bannerText); | 692 $('banner-text').textContent = loadTimeData.getString(bannerText); |
674 } | 693 } |
675 }, | 694 }, |
676 | 695 |
677 /** | 696 /** |
678 * Handler for when the user clicks on the checkbox to allow a | 697 * Handler for when the user clicks on the checkbox to allow a |
679 * single proxy usage. | 698 * single proxy usage. |
680 * @private | 699 * @private |
681 * @param {Event} e Click Event. | 700 * @param {Event=} opt_e Click event. |
682 */ | 701 */ |
683 toggleSingleProxy_: function(e) { | 702 toggleSingleProxy_: function(opt_e) { |
684 if ($('proxy-all-protocols').checked) { | 703 if ($('proxy-all-protocols').checked) { |
685 $('multi-proxy').hidden = true; | 704 $('multi-proxy').hidden = true; |
686 $('single-proxy').hidden = false; | 705 $('single-proxy').hidden = false; |
687 } else { | 706 } else { |
688 $('multi-proxy').hidden = false; | 707 $('multi-proxy').hidden = false; |
689 $('single-proxy').hidden = true; | 708 $('single-proxy').hidden = true; |
690 } | 709 } |
691 }, | 710 }, |
692 | 711 |
693 /** | 712 /** |
694 * Handler for when the user clicks on the checkbox to enter | 713 * Handler for when the user clicks on the checkbox to enter |
695 * auto configuration URL. | 714 * auto configuration URL. |
696 * @private | 715 * @private |
697 * @param {Event} e Click Event. | 716 * @param {Event=} opt_e Click Event. |
698 */ | 717 */ |
699 handleAutoConfigProxy_: function(e) { | 718 handleAutoConfigProxy_: function(opt_e) { |
Dan Beam
2014/09/06 02:22:36
can you just make these methods not take a paramet
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
| |
700 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; | 719 $('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; |
701 }, | 720 }, |
702 | 721 |
703 /** | 722 /** |
704 * Handler for selecting a radio button that will disable the manual | 723 * Handler for selecting a radio button that will disable the manual |
705 * controls. | 724 * controls. |
706 * @private | 725 * @private |
707 * @param {Event} e Click event. | 726 * @param {Event=} opt_e Click event. |
708 */ | 727 */ |
709 disableManualProxy_: function(e) { | 728 disableManualProxy_: function(opt_e) { |
710 $('ignored-host-list').disabled = true; | 729 $('ignored-host-list').disabled = true; |
711 $('new-host').disabled = true; | 730 $('new-host').disabled = true; |
712 $('remove-host').disabled = true; | 731 $('remove-host').disabled = true; |
713 $('add-host').disabled = true; | 732 $('add-host').disabled = true; |
714 $('proxy-all-protocols').disabled = true; | 733 $('proxy-all-protocols').disabled = true; |
715 $('proxy-host-name').disabled = true; | 734 $('proxy-host-name').disabled = true; |
716 $('proxy-host-port').disabled = true; | 735 $('proxy-host-port').disabled = true; |
717 $('proxy-host-single-name').disabled = true; | 736 $('proxy-host-single-name').disabled = true; |
718 $('proxy-host-single-port').disabled = true; | 737 $('proxy-host-single-port').disabled = true; |
719 $('secure-proxy-host-name').disabled = true; | 738 $('secure-proxy-host-name').disabled = true; |
720 $('secure-proxy-port').disabled = true; | 739 $('secure-proxy-port').disabled = true; |
721 $('ftp-proxy').disabled = true; | 740 $('ftp-proxy').disabled = true; |
722 $('ftp-proxy-port').disabled = true; | 741 $('ftp-proxy-port').disabled = true; |
723 $('socks-host').disabled = true; | 742 $('socks-host').disabled = true; |
724 $('socks-port').disabled = true; | 743 $('socks-port').disabled = true; |
725 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || | 744 $('proxy-use-pac-url').disabled = $('auto-proxy').disabled || |
726 !$('auto-proxy').checked; | 745 !$('auto-proxy').checked; |
727 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || | 746 $('proxy-pac-url').disabled = $('proxy-use-pac-url').disabled || |
728 !$('proxy-use-pac-url').checked; | 747 !$('proxy-use-pac-url').checked; |
729 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; | 748 $('auto-proxy-parms').hidden = !$('auto-proxy').checked; |
730 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; | 749 $('manual-proxy-parms').hidden = !$('manual-proxy').checked; |
731 chrome.send('coreOptionsUserMetricsAction', | 750 chrome.send('coreOptionsUserMetricsAction', |
732 ['Options_NetworkManualProxy_Disable']); | 751 ['Options_NetworkManualProxy_Disable']); |
733 }, | 752 }, |
734 | 753 |
735 /** | 754 /** |
736 * Handler for selecting a radio button that will enable the manual | 755 * Handler for selecting a radio button that will enable the manual |
737 * controls. | 756 * controls. |
738 * @private | 757 * @private |
739 * @param {Event} e Click event. | 758 * @param {Event=} opt_e Click event. |
740 */ | 759 */ |
741 enableManualProxy_: function(e) { | 760 enableManualProxy_: function(opt_e) { |
742 $('ignored-host-list').redraw(); | 761 $('ignored-host-list').redraw(); |
743 var allDisabled = $('manual-proxy').disabled; | 762 var allDisabled = $('manual-proxy').disabled; |
744 $('ignored-host-list').disabled = allDisabled; | 763 $('ignored-host-list').disabled = allDisabled; |
745 $('new-host').disabled = allDisabled; | 764 $('new-host').disabled = allDisabled; |
746 $('remove-host').disabled = allDisabled; | 765 $('remove-host').disabled = allDisabled; |
747 $('add-host').disabled = allDisabled; | 766 $('add-host').disabled = allDisabled; |
748 $('proxy-all-protocols').disabled = allDisabled; | 767 $('proxy-all-protocols').disabled = allDisabled; |
749 $('proxy-host-name').disabled = allDisabled; | 768 $('proxy-host-name').disabled = allDisabled; |
750 $('proxy-host-port').disabled = allDisabled; | 769 $('proxy-host-port').disabled = allDisabled; |
751 $('proxy-host-single-name').disabled = allDisabled; | 770 $('proxy-host-single-name').disabled = allDisabled; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 if (data.Type == 'Cellular') | 923 if (data.Type == 'Cellular') |
905 chrome.send('networkCommand', [data.type, servicePath, 'activate']); | 924 chrome.send('networkCommand', [data.type, servicePath, 'activate']); |
906 PageManager.closeOverlay(); | 925 PageManager.closeOverlay(); |
907 }; | 926 }; |
908 | 927 |
909 DetailsInternetPage.setDetails = function() { | 928 DetailsInternetPage.setDetails = function() { |
910 var data = $('connection-state').data; | 929 var data = $('connection-state').data; |
911 var servicePath = data.servicePath; | 930 var servicePath = data.servicePath; |
912 if (data.type == 'WiFi') { | 931 if (data.type == 'WiFi') { |
913 sendCheckedIfEnabled(servicePath, 'setPreferNetwork', | 932 sendCheckedIfEnabled(servicePath, 'setPreferNetwork', |
914 $('prefer-network-wifi')); | 933 /** @type {HTMLInputElement} */($('prefer-network-wifi'))); |
Dan Beam
2014/09/06 02:22:36
assertInstanceof, IMO
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
| |
915 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 934 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
916 $('auto-connect-network-wifi')); | 935 /** @type {HTMLInputElement} */($('auto-connect-network-wifi'))); |
917 } else if (data.type == 'Wimax') { | 936 } else if (data.type == 'Wimax') { |
918 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 937 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
919 $('auto-connect-network-wimax')); | 938 /** @type {HTMLInputElement} */($('auto-connect-network-wimax'))); |
920 } else if (data.type == 'Cellular') { | 939 } else if (data.type == 'Cellular') { |
921 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 940 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
922 $('auto-connect-network-cellular')); | 941 /** @type {HTMLInputElement} */($('auto-connect-network-cellular'))); |
923 } else if (data.type == 'VPN') { | 942 } else if (data.type == 'VPN') { |
924 chrome.send('setServerHostname', | 943 chrome.send('setServerHostname', |
925 [servicePath, | 944 [servicePath, |
926 $('inet-server-hostname').value]); | 945 $('inet-server-hostname').value]); |
927 sendCheckedIfEnabled(servicePath, 'setAutoConnect', | 946 sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
928 $('auto-connect-network-vpn')); | 947 /** @type {HTMLInputElement} */($('auto-connect-network-vpn'))); |
929 } | 948 } |
930 | 949 |
931 var nameServerTypes = ['automatic', 'google', 'user']; | 950 var nameServerTypes = ['automatic', 'google', 'user']; |
932 var nameServerType = 'automatic'; | 951 var nameServerType = 'automatic'; |
933 for (var i = 0; i < nameServerTypes.length; ++i) { | 952 for (var i = 0; i < nameServerTypes.length; ++i) { |
934 if ($(nameServerTypes[i] + '-dns-radio').checked) { | 953 if ($(nameServerTypes[i] + '-dns-radio').checked) { |
935 nameServerType = nameServerTypes[i]; | 954 nameServerType = nameServerTypes[i]; |
936 break; | 955 break; |
937 } | 956 } |
938 } | 957 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 | 1067 |
1049 this.updateConnectionButtonVisibilty(data); | 1068 this.updateConnectionButtonVisibilty(data); |
1050 | 1069 |
1051 if (data.type == 'WiFi') { | 1070 if (data.type == 'WiFi') { |
1052 $('wifi-connection-state').textContent = connectionStateString; | 1071 $('wifi-connection-state').textContent = connectionStateString; |
1053 } else if (data.type == 'Wimax') { | 1072 } else if (data.type == 'Wimax') { |
1054 $('wimax-connection-state').textContent = connectionStateString; | 1073 $('wimax-connection-state').textContent = connectionStateString; |
1055 } else if (data.type == 'Cellular') { | 1074 } else if (data.type == 'Cellular') { |
1056 $('activation-state').textContent = data.activationState; | 1075 $('activation-state').textContent = data.activationState; |
1057 | 1076 |
1058 $('buyplan-details').hidden = !data.showBuyButton; | 1077 $('buyplan-details').hidden = true; |
1059 $('view-account-details').hidden = !data.showViewAccountButton; | 1078 $('view-account-details').hidden = !data.showViewAccountButton; |
1060 | 1079 |
1061 $('activate-details').hidden = !data.showActivateButton; | 1080 $('activate-details').hidden = !data.showActivateButton; |
1062 if (data.showActivateButton) | 1081 if (data.showActivateButton) |
1063 $('details-internet-login').hidden = true; | 1082 $('details-internet-login').hidden = true; |
1064 | 1083 |
1065 if (detailsPage.gsm) { | 1084 if (detailsPage.gsm) { |
1066 var lockEnabled = | 1085 var lockEnabled = |
1067 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); | 1086 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); |
1068 $('sim-card-lock-enabled').checked = lockEnabled; | 1087 $('sim-card-lock-enabled').checked = lockEnabled; |
1069 $('change-pin').hidden = !lockEnabled; | 1088 $('change-pin').hidden = !lockEnabled; |
1070 } | 1089 } |
1071 } | 1090 } |
1072 | 1091 |
1073 $('connection-state').data = data; | 1092 $('connection-state').data = data; |
1074 }; | 1093 }; |
1075 | 1094 |
1095 /** | |
1096 * @param {InternetDetailedInfo} data | |
1097 */ | |
1076 DetailsInternetPage.showDetailedInfo = function(data) { | 1098 DetailsInternetPage.showDetailedInfo = function(data) { |
1077 var detailsPage = DetailsInternetPage.getInstance(); | 1099 var detailsPage = DetailsInternetPage.getInstance(); |
1078 | 1100 |
1079 data.type = getManagedValue(data, 'Type'); // Get Active Type value. | 1101 data.type = getManagedValue(data, 'Type'); // Get Active Type value. |
1080 | 1102 |
1081 // Populate header | 1103 // Populate header |
1082 $('network-details-title').textContent = getNetworkName(data); | 1104 $('network-details-title').textContent = getNetworkName(data); |
1083 var connectionState = getManagedValue(data, 'ConnectionState'); | 1105 var connectionState = getManagedValue(data, 'ConnectionState'); |
1084 var connectionStateString = networkOncStateString(connectionState); | 1106 var connectionStateString = networkOncStateString(connectionState); |
1085 detailsPage.connected = connectionState == 'Connected'; | 1107 detailsPage.connected = connectionState == 'Connected'; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1416 updateHidden('.apn-details-view', true); | 1438 updateHidden('.apn-details-view', true); |
1417 var lockEnabled = | 1439 var lockEnabled = |
1418 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); | 1440 getManagedValue(data, 'Cellular.SIMLockStatus.LockEnabled'); |
1419 $('sim-card-lock-enabled').checked = lockEnabled; | 1441 $('sim-card-lock-enabled').checked = lockEnabled; |
1420 $('change-pin').hidden = !lockEnabled; | 1442 $('change-pin').hidden = !lockEnabled; |
1421 } | 1443 } |
1422 $('auto-connect-network-cellular').checked = | 1444 $('auto-connect-network-cellular').checked = |
1423 getManagedValue(data, 'AutoConnect'); | 1445 getManagedValue(data, 'AutoConnect'); |
1424 $('auto-connect-network-cellular').disabled = false; | 1446 $('auto-connect-network-cellular').disabled = false; |
1425 | 1447 |
1426 $('buyplan-details').hidden = !data.showBuyButton; | 1448 $('buyplan-details').hidden = true; |
Dan Beam
2014/09/06 02:22:36
it doesn't seem like this button is ever used (nor
Vitaly Pavlenko
2014/09/06 22:54:07
Do you know how can I open this internet_detail.ht
Dan Beam
2014/09/09 02:59:09
stevenjb@ is removing this, I think
Vitaly Pavlenko
2014/09/09 17:54:51
Acknowledged.
| |
1427 $('view-account-details').hidden = !data.showViewAccountButton; | 1449 $('view-account-details').hidden = !data.showViewAccountButton; |
1428 $('activate-details').hidden = !data.showActivateButton; | 1450 $('activate-details').hidden = !data.showActivateButton; |
1429 if (data.showActivateButton) { | 1451 if (data.showActivateButton) { |
1430 $('details-internet-login').hidden = true; | 1452 $('details-internet-login').hidden = true; |
1431 } | 1453 } |
1432 } else if (data.type == 'VPN') { | 1454 } else if (data.type == 'VPN') { |
1433 OptionsPage.showTab($('vpn-nav-tab')); | 1455 OptionsPage.showTab($('vpn-nav-tab')); |
1434 detailsPage.gsm = false; | 1456 detailsPage.gsm = false; |
1435 $('inet-service-name').textContent = networkName; | 1457 $('inet-service-name').textContent = networkName; |
1436 $('inet-provider-type').textContent = | 1458 $('inet-provider-type').textContent = |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1488 | 1510 |
1489 // Don't show page name in address bar and in history to prevent people | 1511 // Don't show page name in address bar and in history to prevent people |
1490 // navigate here by hand and solve issue with page session restore. | 1512 // navigate here by hand and solve issue with page session restore. |
1491 PageManager.showPageByName('detailsInternetPage', false); | 1513 PageManager.showPageByName('detailsInternetPage', false); |
1492 }; | 1514 }; |
1493 | 1515 |
1494 return { | 1516 return { |
1495 DetailsInternetPage: DetailsInternetPage | 1517 DetailsInternetPage: DetailsInternetPage |
1496 }; | 1518 }; |
1497 }); | 1519 }); |
OLD | NEW |