| 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 /** | 5 /** |
| 6 * @fileoverview Oobe eula screen implementation. | 6 * @fileoverview Oobe eula screen implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('oobe', function() { | 9 cr.define('oobe', function() { |
| 10 /** | 10 /** |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // WebKit does not allow immediate focus return. | 46 // WebKit does not allow immediate focus return. |
| 47 window.setTimeout(function() { | 47 window.setTimeout(function() { |
| 48 // TODO(ivankr): focus cycling. | 48 // TODO(ivankr): focus cycling. |
| 49 $('installation-settings-ok-button').focus(); | 49 $('installation-settings-ok-button').focus(); |
| 50 }, 0); | 50 }, 0); |
| 51 event.preventDefault(); | 51 event.preventDefault(); |
| 52 }); | 52 }); |
| 53 }, | 53 }, |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Event handler that is invoked just before the screen is shown. |
| 57 * @param {object} data Screen init payload. |
| 58 */ |
| 59 onBeforeShow: function() { |
| 60 $('eula').classList.add('eula-loading'); |
| 61 $('cros-eula-frame').onload = function() { |
| 62 $('accept-button').disabled = false; |
| 63 $('eula').classList.remove('eula-loading'); |
| 64 } |
| 65 $('cros-eula-frame').src = 'chrome://terms'; |
| 66 }, |
| 67 |
| 68 /** |
| 56 * Header text of the screen. | 69 * Header text of the screen. |
| 57 * @type {string} | 70 * @type {string} |
| 58 */ | 71 */ |
| 59 get header() { | 72 get header() { |
| 60 return loadTimeData.getString('eulaScreenTitle'); | 73 return loadTimeData.getString('eulaScreenTitle'); |
| 61 }, | 74 }, |
| 62 | 75 |
| 63 /** | 76 /** |
| 64 * Buttons in oobe wizard's button strip. | 77 * Buttons in oobe wizard's button strip. |
| 65 * @type {array} Array of Buttons. | 78 * @type {array} Array of Buttons. |
| 66 */ | 79 */ |
| 67 get buttons() { | 80 get buttons() { |
| 68 var buttons = []; | 81 var buttons = []; |
| 69 | 82 |
| 70 var backButton = this.ownerDocument.createElement('button'); | 83 var backButton = this.ownerDocument.createElement('button'); |
| 71 backButton.id = 'back-button'; | 84 backButton.id = 'back-button'; |
| 72 backButton.textContent = loadTimeData.getString('back'); | 85 backButton.textContent = loadTimeData.getString('back'); |
| 73 backButton.addEventListener('click', function(e) { | 86 backButton.addEventListener('click', function(e) { |
| 74 chrome.send('eulaOnExit', [false, $('usage-stats').checked]); | 87 chrome.send('eulaOnExit', [false, $('usage-stats').checked]); |
| 75 e.stopPropagation(); | 88 e.stopPropagation(); |
| 76 }); | 89 }); |
| 77 buttons.push(backButton); | 90 buttons.push(backButton); |
| 78 | 91 |
| 79 var acceptButton = this.ownerDocument.createElement('button'); | 92 var acceptButton = this.ownerDocument.createElement('button'); |
| 80 acceptButton.id = 'accept-button'; | 93 acceptButton.id = 'accept-button'; |
| 94 acceptButton.disabled = true; |
| 95 acceptButton.classList.add('preserve-disabled-state'); |
| 81 acceptButton.textContent = loadTimeData.getString('acceptAgreement'); | 96 acceptButton.textContent = loadTimeData.getString('acceptAgreement'); |
| 82 acceptButton.addEventListener('click', function(e) { | 97 acceptButton.addEventListener('click', function(e) { |
| 83 $('eula').classList.add('loading'); // Mark EULA screen busy. | 98 $('eula').classList.add('loading'); // Mark EULA screen busy. |
| 84 chrome.send('eulaOnExit', [true, $('usage-stats').checked]); | 99 chrome.send('eulaOnExit', [true, $('usage-stats').checked]); |
| 85 e.stopPropagation(); | 100 e.stopPropagation(); |
| 86 }); | 101 }); |
| 87 buttons.push(acceptButton); | 102 buttons.push(acceptButton); |
| 88 | 103 |
| 89 return buttons; | 104 return buttons; |
| 90 }, | 105 }, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 $('cros-eula-frame').src = $('cros-eula-frame').src; | 119 $('cros-eula-frame').src = $('cros-eula-frame').src; |
| 105 if ($('oem-eula-frame').src != '') | 120 if ($('oem-eula-frame').src != '') |
| 106 $('oem-eula-frame').src = $('oem-eula-frame').src; | 121 $('oem-eula-frame').src = $('oem-eula-frame').src; |
| 107 } | 122 } |
| 108 }; | 123 }; |
| 109 | 124 |
| 110 return { | 125 return { |
| 111 EulaScreen: EulaScreen | 126 EulaScreen: EulaScreen |
| 112 }; | 127 }; |
| 113 }); | 128 }); |
| OLD | NEW |