OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
10 // InternetOptions class: | 10 // InternetOptions class: |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 // Inherit InternetOptions from OptionsPage. | 23 // Inherit InternetOptions from OptionsPage. |
24 InternetOptions.prototype = { | 24 InternetOptions.prototype = { |
25 __proto__: OptionsPage.prototype, | 25 __proto__: OptionsPage.prototype, |
26 | 26 |
27 /** | 27 /** |
28 * Initializes InternetOptions page. | 28 * Initializes InternetOptions page. |
29 * Calls base class implementation to starts preference initialization. | 29 * Calls base class implementation to starts preference initialization. |
30 */ | 30 */ |
31 initializePage: function() { | 31 initializePage: function() { |
32 // Call base class implementation to starts preference initialization. | |
33 OptionsPage.prototype.initializePage.call(this); | 32 OptionsPage.prototype.initializePage.call(this); |
34 | 33 |
35 options.internet.NetworkElement.decorate($('wiredList')); | 34 options.internet.NetworkElement.decorate($('wiredList')); |
36 $('wiredList').load(templateData.wiredList); | 35 $('wiredList').load(templateData.wiredList); |
37 options.internet.NetworkElement.decorate($('wirelessList')); | 36 options.internet.NetworkElement.decorate($('wirelessList')); |
38 $('wirelessList').load(templateData.wirelessList); | 37 $('wirelessList').load(templateData.wirelessList); |
39 options.internet.NetworkElement.decorate($('rememberedList')); | 38 options.internet.NetworkElement.decorate($('rememberedList')); |
40 $('rememberedList').load(templateData.rememberedList); | 39 $('rememberedList').load(templateData.rememberedList); |
41 | 40 |
42 $('wiredSection').hidden = (templateData.wiredList.length == 0); | 41 $('wiredSection').hidden = (templateData.wiredList.length == 0); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 var servicePath = params.servicePath; | 83 var servicePath = params.servicePath; |
85 var networkType = params.networkType; | 84 var networkType = params.networkType; |
86 if (!servicePath || !servicePath.length || | 85 if (!servicePath || !servicePath.length || |
87 !networkType || !networkType.length) | 86 !networkType || !networkType.length) |
88 return; | 87 return; |
89 chrome.send('buttonClickCallback', | 88 chrome.send('buttonClickCallback', |
90 [networkType, servicePath, "options"]); | 89 [networkType, servicePath, "options"]); |
91 } | 90 } |
92 }; | 91 }; |
93 | 92 |
| 93 // Network status update will be blocked while typing in WEP password etc. |
| 94 InternetOptions.updateLocked = false; |
| 95 InternetOptions.updatePending = false; |
| 96 InternetOptions.updataData = null; |
| 97 |
94 InternetOptions.loginFromDetails = function () { | 98 InternetOptions.loginFromDetails = function () { |
95 var data = $('inetAddress').data; | 99 var data = $('inetAddress').data; |
96 var servicePath = data.servicePath; | 100 var servicePath = data.servicePath; |
97 if (data.certinpkcs) { | 101 if (data.certinpkcs) { |
98 chrome.send('loginToCertNetwork',[String(servicePath), | 102 chrome.send('loginToCertNetwork',[String(servicePath), |
99 String(data.certPath), | 103 String(data.certPath), |
100 String(data.ident)]); | 104 String(data.ident)]); |
101 } else { | 105 } else { |
102 chrome.send('loginToCertNetwork',[String(servicePath), | 106 chrome.send('loginToCertNetwork',[String(servicePath), |
103 String($('inetCert').value), | 107 String($('inetCert').value), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 $('enableCellular').disabled = false; | 147 $('enableCellular').disabled = false; |
144 $('enableCellular').classList.remove('hidden'); | 148 $('enableCellular').classList.remove('hidden'); |
145 $('disableCellular').classList.add('hidden'); | 149 $('disableCellular').classList.add('hidden'); |
146 } | 150 } |
147 } else { | 151 } else { |
148 $('enableCellular').classList.add('hidden'); | 152 $('enableCellular').classList.add('hidden'); |
149 $('disableCellular').classList.add('hidden'); | 153 $('disableCellular').classList.add('hidden'); |
150 } | 154 } |
151 }; | 155 }; |
152 | 156 |
| 157 // Prevent clobbering of password input field. |
| 158 InternetOptions.lockUpdates = function () { |
| 159 InternetOptions.updateLocked = true; |
| 160 }; |
| 161 |
| 162 InternetOptions.unlockUpdates = function () { |
| 163 InternetOptions.updateLocked = false; |
| 164 if (InternetOptions.updatePending) { |
| 165 InternetOptions.refreshNetworkData(InternetOptions.updateData); |
| 166 } |
| 167 }; |
| 168 |
153 // | 169 // |
154 //Chrome callbacks | 170 //Chrome callbacks |
155 // | 171 // |
156 InternetOptions.refreshNetworkData = function (data) { | 172 InternetOptions.refreshNetworkData = function (data) { |
157 $('wiredList').load(data.wiredList); | 173 if (InternetOptions.updateLocked) { |
158 $('wirelessList').load(data.wirelessList); | 174 InternetOptions.updateData = data; |
159 $('rememberedList').load(data.rememberedList); | 175 InternetOptions.updatePending = true; |
| 176 } else { |
| 177 $('wiredList').load(data.wiredList); |
| 178 $('wirelessList').load(data.wirelessList); |
| 179 $('rememberedList').load(data.rememberedList); |
160 | 180 |
161 $('wiredSection').hidden = (data.wiredList.length == 0); | 181 $('wiredSection').hidden = (data.wiredList.length == 0); |
162 $('wirelessSection').hidden = (data.wirelessList.length == 0); | 182 $('wirelessSection').hidden = (data.wirelessList.length == 0); |
163 InternetOptions.setupAttributes(data); | 183 InternetOptions.setupAttributes(data); |
164 $('rememberedSection').hidden = (data.rememberedList.length == 0); | 184 $('rememberedSection').hidden = (data.rememberedList.length == 0); |
| 185 InternetOptions.updateData = null; |
| 186 InternetOptions.updatePending = false; |
| 187 } |
165 }; | 188 }; |
166 | 189 |
167 InternetOptions.updateCellularPlans = function (data) { | 190 InternetOptions.updateCellularPlans = function (data) { |
168 var page = $('detailsInternetPage'); | 191 var page = $('detailsInternetPage'); |
169 if (!data.plans || !data.plans.length || !data.plans[0].plan_type) { | 192 if (!data.plans || !data.plans.length || !data.plans[0].plan_type) { |
170 // No cellular data plan. | 193 // No cellular data plan. |
171 page.setAttribute('nocellplan', true); | 194 page.setAttribute('nocellplan', true); |
172 page.removeAttribute('hascellplan'); | 195 page.removeAttribute('hascellplan'); |
173 } else { | 196 } else { |
174 page.removeAttribute('nocellplan'); | 197 page.removeAttribute('nocellplan'); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 327 } |
305 OptionsPage.showOverlay('detailsInternetPage'); | 328 OptionsPage.showOverlay('detailsInternetPage'); |
306 }; | 329 }; |
307 | 330 |
308 // Export | 331 // Export |
309 return { | 332 return { |
310 InternetOptions: InternetOptions | 333 InternetOptions: InternetOptions |
311 }; | 334 }; |
312 | 335 |
313 }); | 336 }); |
OLD | NEW |