OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 | 7 |
8 ///////////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////////// |
9 // InternetOptions class: | 9 // InternetOptions class: |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 $('wiredSection').hidden = (templateData.wiredList.length == 0); | 47 $('wiredSection').hidden = (templateData.wiredList.length == 0); |
48 $('wirelessSection').hidden = (templateData.wirelessList.length == 0); | 48 $('wirelessSection').hidden = (templateData.wirelessList.length == 0); |
49 $('rememberedSection').hidden = (templateData.rememberedList.length == 0); | 49 $('rememberedSection').hidden = (templateData.rememberedList.length == 0); |
50 InternetOptions.setupAttributes(templateData); | 50 InternetOptions.setupAttributes(templateData); |
51 $('detailsInternetDismiss').addEventListener('click', function(event) { | 51 $('detailsInternetDismiss').addEventListener('click', function(event) { |
52 OptionsPage.clsoeOverlay(true); | 52 OptionsPage.clsoeOverlay(true); |
53 }); | 53 }); |
54 $('detailsInternetLogin').addEventListener('click', function(event) { | 54 $('detailsInternetLogin').addEventListener('click', function(event) { |
55 InternetOptions.loginFromDetails(); | 55 InternetOptions.loginFromDetails(); |
56 });; | 56 }); |
57 $('activateDetails').addEventListener('click', function(event) { | 57 $('activateDetails').addEventListener('click', function(event) { |
58 InternetOptions.activateFromDetails(); | 58 InternetOptions.activateFromDetails(); |
59 }); | 59 }); |
60 $('enableWifi').addEventListener('click', function(event) { | 60 $('enableWifi').addEventListener('click', function(event) { |
61 event.target.disabled = true; | 61 event.target.disabled = true; |
62 chrome.send('enableWifi', []); | 62 chrome.send('enableWifi', []); |
63 }); | 63 }); |
64 $('disableWifi').addEventListener('click', function(event) { | 64 $('disableWifi').addEventListener('click', function(event) { |
65 event.target.disabled = true; | 65 event.target.disabled = true; |
66 chrome.send('disableWifi', []); | 66 chrome.send('disableWifi', []); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 var page = $('detailsInternetPage'); | 206 var page = $('detailsInternetPage'); |
207 page.removeAttribute('cellplanloading'); | 207 page.removeAttribute('cellplanloading'); |
208 if (data.plans && data.plans.length) { | 208 if (data.plans && data.plans.length) { |
209 page.removeAttribute('nocellplan'); | 209 page.removeAttribute('nocellplan'); |
210 page.setAttribute('hascellplan', true); | 210 page.setAttribute('hascellplan', true); |
211 $('planList').load(data.plans); | 211 $('planList').load(data.plans); |
212 } else { | 212 } else { |
213 page.setAttribute('nocellplan', true); | 213 page.setAttribute('nocellplan', true); |
214 page.removeAttribute('hascellplan'); | 214 page.removeAttribute('hascellplan'); |
215 } | 215 } |
216 if (!data.needsPlan) { | 216 |
| 217 if (!data.needsPlan) |
217 page.setAttribute('hasactiveplan', true); | 218 page.setAttribute('hasactiveplan', true); |
218 } else { | 219 else |
219 page.removeAttribute('hasactiveplan'); | 220 page.removeAttribute('hasactiveplan'); |
220 } | 221 |
221 if (data.activated) { | 222 if (data.activated) |
222 page.setAttribute('activated', true); | 223 page.setAttribute('activated', true); |
223 } else { | 224 else |
224 page.removeAttribute('activated'); | 225 page.removeAttribute('activated'); |
225 } | 226 |
| 227 if (data.showBuyButton) |
| 228 page.setAttribute('showbuy', true); |
| 229 else |
| 230 page.removeAttribute('showbuy'); |
| 231 |
| 232 if (data.showActivateButton) |
| 233 page.setAttribute('showactivate', true); |
| 234 else |
| 235 page.removeAttribute('showactivate'); |
226 | 236 |
227 // Nudge webkit so that it redraws the details overlay page. | 237 // Nudge webkit so that it redraws the details overlay page. |
228 // See http://crosbug.com/9616 for details. | 238 // See http://crosbug.com/9616 for details. |
229 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=50176 | 239 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=50176 |
230 var dummy = page.ownerDocument.createTextNode(' '); | 240 var dummy = page.ownerDocument.createTextNode(' '); |
231 page.appendChild(dummy); | 241 page.appendChild(dummy); |
232 page.removeChild(dummy); | 242 page.removeChild(dummy); |
233 }; | 243 }; |
234 | 244 |
235 InternetOptions.showPasswordEntry = function (data) { | 245 InternetOptions.showPasswordEntry = function (data) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 $('esn').textContent = data.esn; | 342 $('esn').textContent = data.esn; |
333 $('min').textContent = data.min; | 343 $('min').textContent = data.min; |
334 if (!data.gsm) { | 344 if (!data.gsm) { |
335 page.removeAttribute('gsm'); | 345 page.removeAttribute('gsm'); |
336 } else { | 346 } else { |
337 $('operatorName').textContent = data.operatorName; | 347 $('operatorName').textContent = data.operatorName; |
338 $('operatorCode').textContent = data.operatorCode; | 348 $('operatorCode').textContent = data.operatorCode; |
339 $('imsi').textContent = data.imsi; | 349 $('imsi').textContent = data.imsi; |
340 page.setAttribute('gsm', true); | 350 page.setAttribute('gsm', true); |
341 } | 351 } |
| 352 |
| 353 if (data.showBuyButton) |
| 354 page.setAttribute('showbuy', true); |
| 355 else |
| 356 page.removeAttribute('showbuy'); |
| 357 if (data.showActivateButton) |
| 358 page.setAttribute('showactivate', true); |
| 359 else |
| 360 page.removeAttribute('showactivate'); |
| 361 |
342 page.removeAttribute('hascellplan'); | 362 page.removeAttribute('hascellplan'); |
343 if (data.connected) { | 363 if (data.connected) { |
344 page.removeAttribute('nocellplan'); | 364 page.removeAttribute('nocellplan'); |
345 page.setAttribute('cellplanloading', true); | 365 page.setAttribute('cellplanloading', true); |
346 chrome.send('refreshCellularPlan', [data.servicePath]) | 366 chrome.send('refreshCellularPlan', [data.servicePath]) |
347 } else { | 367 } else { |
348 page.setAttribute('nocellplan', true); | 368 page.setAttribute('nocellplan', true); |
349 page.removeAttribute('cellplanloading'); | 369 page.removeAttribute('cellplanloading'); |
350 } | 370 } |
351 } else { | 371 } else { |
352 OptionsPage.showTab($('internetNavTab')); | 372 OptionsPage.showTab($('internetNavTab')); |
353 page.setAttribute('ethernet', true); | 373 page.setAttribute('ethernet', true); |
354 page.removeAttribute('wireless'); | 374 page.removeAttribute('wireless'); |
355 page.removeAttribute('cert'); | 375 page.removeAttribute('cert'); |
356 page.removeAttribute('certPkcs'); | 376 page.removeAttribute('certPkcs'); |
357 page.removeAttribute('cellular'); | 377 page.removeAttribute('cellular'); |
358 page.removeAttribute('gsm'); | 378 page.removeAttribute('gsm'); |
359 } | 379 } |
360 OptionsPage.navigateToPage('detailsInternetPage'); | 380 OptionsPage.navigateToPage('detailsInternetPage'); |
361 }; | 381 }; |
362 | 382 |
363 // Export | 383 // Export |
364 return { | 384 return { |
365 InternetOptions: InternetOptions | 385 InternetOptions: InternetOptions |
366 }; | 386 }; |
367 }); | 387 }); |
OLD | NEW |