OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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('chargerReplacement', function() { | 5 cr.define('chargerReplacement', function() { |
6 | 6 |
7 /** | 7 /** |
8 * Enumeration of charger selection. | 8 * Enumeration of charger selection. |
9 * @enum {int} | 9 * @enum {int} |
10 */ | 10 */ |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 selectCharger(CHARGER_SELECTION.GOOD_CHARGER); | 305 selectCharger(CHARGER_SELECTION.GOOD_CHARGER); |
306 }; | 306 }; |
307 $('original-charger').onclick = function() { | 307 $('original-charger').onclick = function() { |
308 selectCharger(CHARGER_SELECTION.ORIGINAL_CHARGER); | 308 selectCharger(CHARGER_SELECTION.ORIGINAL_CHARGER); |
309 }; | 309 }; |
310 $('back-to-check-charger').onclick = function() { | 310 $('back-to-check-charger').onclick = function() { |
311 showPage(PAGES.CHECK_CHARGER); | 311 showPage(PAGES.CHECK_CHARGER); |
312 }; | 312 }; |
313 $('finish-safe-charger').onclick = function() { | 313 $('finish-safe-charger').onclick = function() { |
314 chrome.send('confirmSafeCharger'); | 314 chrome.send('confirmSafeCharger'); |
315 chrome.send('DialogClose'); | 315 chrome.send('dialogClose'); |
316 }; | 316 }; |
317 $('not-order-charger-checkbox-strip').style.visibility = 'hidden'; | 317 $('not-order-charger-checkbox-strip').style.visibility = 'hidden'; |
318 $('back-to-check-charger-from-charger-update').onclick = function() { | 318 $('back-to-check-charger-from-charger-update').onclick = function() { |
319 showPage(PAGES.CHECK_CHARGER); | 319 showPage(PAGES.CHECK_CHARGER); |
320 }; | 320 }; |
321 $('next-to-charger-update').onclick = function() { | 321 $('next-to-charger-update').onclick = function() { |
322 nextStepForChargerUpdate(); | 322 nextStepForChargerUpdate(); |
323 }; | 323 }; |
324 $('order-new-charger').onclick = function() { | 324 $('order-new-charger').onclick = function() { |
325 afterUserConfirmationForChargerUpdate(); | 325 afterUserConfirmationForChargerUpdate(); |
326 }; | 326 }; |
327 $('not-order-new-charger').onclick = function() { | 327 $('not-order-new-charger').onclick = function() { |
328 afterUserConfirmationForChargerUpdate(); | 328 afterUserConfirmationForChargerUpdate(); |
329 }; | 329 }; |
330 $('confirm-not-order-charger').onclick = function() { | 330 $('confirm-not-order-charger').onclick = function() { |
331 afterUserConfirmationForChargerUpdate(); | 331 afterUserConfirmationForChargerUpdate(); |
332 }; | 332 }; |
333 $('finish-not-order-new-charger').onclick = function() { | 333 $('finish-not-order-new-charger').onclick = function() { |
334 chrome.send('confirmNotOrderNewCharger'); | 334 chrome.send('confirmNotOrderNewCharger'); |
335 chrome.send('DialogClose'); | 335 chrome.send('dialogClose'); |
336 }; | 336 }; |
337 $('finish-online-order').onclick = function() { | 337 $('finish-online-order').onclick = function() { |
338 chrome.send('confirmChargerOrderedOnline'); | 338 chrome.send('confirmChargerOrderedOnline'); |
339 chrome.send('DialogClose'); | 339 chrome.send('dialogClose'); |
340 }; | 340 }; |
341 $('offline-order-confirm').onclick = function() { | 341 $('offline-order-confirm').onclick = function() { |
342 $('finish-offline-order').disabled = !$('offline-order-confirm').checked; | 342 $('finish-offline-order').disabled = !$('offline-order-confirm').checked; |
343 }; | 343 }; |
344 $('finish-offline-order').onclick = function() { | 344 $('finish-offline-order').onclick = function() { |
345 chrome.send('confirmChargerOrderByPhone'); | 345 chrome.send('confirmChargerOrderByPhone'); |
346 chrome.send('DialogClose'); | 346 chrome.send('dialogClose'); |
347 }; | 347 }; |
348 $('finish-still-bad-charger').onclick = function() { | 348 $('finish-still-bad-charger').onclick = function() { |
349 chrome.send('confirmStillUseBadCharger'); | 349 chrome.send('confirmStillUseBadCharger'); |
350 chrome.send('DialogClose'); | 350 chrome.send('dialogClose'); |
351 }; | 351 }; |
352 | 352 |
353 var links = document.getElementsByClassName('link'); | 353 var links = document.getElementsByClassName('link'); |
354 for (var i = 0; i < links.length; ++i) { | 354 for (var i = 0; i < links.length; ++i) { |
355 if (links[i].id == 'privacy-link') { | 355 if (links[i].id == 'privacy-link') { |
356 links[i].onclick = function() { | 356 links[i].onclick = function() { |
357 chrome.send('showLink', [PRIVACY_POLICY_LINK]); | 357 chrome.send('showLink', [PRIVACY_POLICY_LINK]); |
358 }; | 358 }; |
359 } else { | 359 } else { |
360 links[i].onclick = function() { | 360 links[i].onclick = function() { |
361 chrome.send('showLink', [CHARGER_FAQ_LINK]); | 361 chrome.send('showLink', [CHARGER_FAQ_LINK]); |
362 }; | 362 }; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 window.addEventListener('message', handleWindowMessage); | 366 window.addEventListener('message', handleWindowMessage); |
367 } | 367 } |
368 | 368 |
369 return { | 369 return { |
370 load: load | 370 load: load |
371 }; | 371 }; |
372 }); | 372 }); |
373 | 373 |
374 document.addEventListener('DOMContentLoaded', chargerReplacement.load); | 374 document.addEventListener('DOMContentLoaded', chargerReplacement.load); |
375 | 375 |
OLD | NEW |