| 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 login.createScreen('EulaScreen', 'eula', function() { | 9 login.createScreen('EulaScreen', 'eula', function() { |
| 10 var CONTEXT_KEY_USAGE_STATS_ENABLED = 'usageStatsEnabled'; | 10 var CONTEXT_KEY_USAGE_STATS_ENABLED = 'usageStatsEnabled'; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // moved the focus anywhere in the meantime. | 66 // moved the focus anywhere in the meantime. |
| 67 if (!$('back-button').blurred) | 67 if (!$('back-button').blurred) |
| 68 $('accept-button').focus(); | 68 $('accept-button').focus(); |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Event handler that is invoked just before the screen is shown. | 72 * Event handler that is invoked just before the screen is shown. |
| 73 * @param {object} data Screen init payload. | 73 * @param {object} data Screen init payload. |
| 74 */ | 74 */ |
| 75 onBeforeShow: function() { | 75 onBeforeShow: function() { |
| 76 this.setMDMode_(); |
| 76 $('eula').classList.add('eula-loading'); | 77 $('eula').classList.add('eula-loading'); |
| 77 $('cros-eula-frame').onload = this.onFrameLoad; | 78 $('cros-eula-frame').onload = this.onFrameLoad; |
| 78 $('accept-button').disabled = true; | 79 $('accept-button').disabled = true; |
| 79 $('cros-eula-frame').src = 'chrome://terms'; | 80 $('cros-eula-frame').src = 'chrome://terms'; |
| 80 }, | 81 }, |
| 81 | 82 |
| 82 /** | 83 /** |
| 83 * Header text of the screen. | 84 * Header text of the screen. |
| 84 * @type {string} | 85 * @type {string} |
| 85 */ | 86 */ |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 function(event) { | 128 function(event) { |
| 128 chrome.send('eulaOnChromeCredits'); | 129 chrome.send('eulaOnChromeCredits'); |
| 129 }); | 130 }); |
| 130 $('eula-chromeos-credits-link').addEventListener('click', | 131 $('eula-chromeos-credits-link').addEventListener('click', |
| 131 function(event) { | 132 function(event) { |
| 132 chrome.send('eulaOnChromeOSCredits'); | 133 chrome.send('eulaOnChromeOSCredits'); |
| 133 }); | 134 }); |
| 134 }, | 135 }, |
| 135 | 136 |
| 136 /** | 137 /** |
| 138 * This method takes care of switching to material-design OOBE. |
| 139 * @private |
| 140 */ |
| 141 setMDMode_: function() { |
| 142 var useMDOobe = (loadTimeData.getString('newOobeUI') == 'on'); |
| 143 $('oobe-eula-md').hidden = !useMDOobe; |
| 144 $('oobe-eula').hidden = useMDOobe; |
| 145 }, |
| 146 |
| 147 /** |
| 137 * Updates localized content of the screen that is not updated via template. | 148 * Updates localized content of the screen that is not updated via template. |
| 138 */ | 149 */ |
| 139 updateLocalizedContent: function() { | 150 updateLocalizedContent: function() { |
| 151 this.setMDMode_(); |
| 152 |
| 140 $('oobe-eula-md').updateLocalizedContent(); | 153 $('oobe-eula-md').updateLocalizedContent(); |
| 141 | 154 |
| 142 // Force iframes to refresh. It's only available method because we have | 155 // Force iframes to refresh. It's only available method because we have |
| 143 // no access to iframe.contentWindow. | 156 // no access to iframe.contentWindow. |
| 144 if ($('cros-eula-frame').src) { | 157 if ($('cros-eula-frame').src) { |
| 145 $('cros-eula-frame').src = $('cros-eula-frame').src; | 158 $('cros-eula-frame').src = $('cros-eula-frame').src; |
| 146 } | 159 } |
| 147 if ($('oem-eula-frame').src) { | 160 if ($('oem-eula-frame').src) { |
| 148 $('oem-eula-frame').src = $('oem-eula-frame').src; | 161 $('oem-eula-frame').src = $('oem-eula-frame').src; |
| 149 } | 162 } |
| 150 } | 163 }, |
| 151 }; | 164 }; |
| 152 }); | 165 }); |
| 153 | 166 |
| OLD | NEW |