Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 EulaScreen.prototype = { | 26 EulaScreen.prototype = { |
| 27 __proto__: HTMLDivElement.prototype, | 27 __proto__: HTMLDivElement.prototype, |
| 28 | 28 |
| 29 /** @inheritDoc */ | 29 /** @inheritDoc */ |
| 30 decorate: function() { | 30 decorate: function() { |
| 31 $('stats-help-link').addEventListener('click', function(event) { | 31 $('stats-help-link').addEventListener('click', function(event) { |
| 32 chrome.send('eulaOnLearnMore'); | 32 chrome.send('eulaOnLearnMore'); |
| 33 }); | 33 }); |
| 34 $('installation-settings-link').addEventListener( | |
| 35 'click', function(event) { | |
| 36 chrome.send('eulaOnInstallationSettingsPopupOpened'); | |
| 37 $('popup-overlay').hidden = false; | |
| 38 $('installation-settings-ok-button').focus(); | |
| 39 }); | |
| 40 $('installation-settings-ok-button').addEventListener( | |
| 41 'click', function(event) { | |
| 42 $('popup-overlay').hidden = true; | |
| 43 }); | |
| 44 // Do not allow focus leaving the overlay. | |
| 45 $('popup-overlay').addEventListener('focusout', function(event) { | |
| 46 // WebKit does not allow immediate focus return. | |
| 47 window.setTimeout(function() { | |
| 48 // TODO(ivankr): focus cycling. | |
|
Nikita (slow)
2012/11/29 11:17:48
We should really fix this in M25. a11y bugs should
Ivan Korotkov
2012/11/29 17:42:28
I'll do this in a follow-up CL
| |
| 49 $('installation-settings-ok-button').focus(); | |
| 50 }, 0); | |
| 51 event.preventDefault(); | |
| 52 }); | |
| 34 }, | 53 }, |
| 35 | 54 |
| 36 /** | 55 /** |
| 37 * Header text of the screen. | 56 * Header text of the screen. |
| 38 * @type {string} | 57 * @type {string} |
| 39 */ | 58 */ |
| 40 get header() { | 59 get header() { |
| 41 return localStrings.getString('eulaScreenTitle'); | 60 return localStrings.getString('eulaScreenTitle'); |
| 42 }, | 61 }, |
| 43 | 62 |
| 44 /** | 63 /** |
| 45 * Buttons in oobe wizard's button strip. | 64 * Buttons in oobe wizard's button strip. |
| 46 * @type {array} Array of Buttons. | 65 * @type {array} Array of Buttons. |
| 47 */ | 66 */ |
| 48 get buttons() { | 67 get buttons() { |
| 49 var buttons = []; | 68 var buttons = []; |
| 50 | 69 |
| 51 var backButton = this.ownerDocument.createElement('button'); | 70 var backButton = this.ownerDocument.createElement('button'); |
| 52 backButton.id = 'back-button'; | 71 backButton.id = 'back-button'; |
| 53 backButton.textContent = localStrings.getString('back'); | 72 backButton.textContent = localStrings.getString('back'); |
| 54 backButton.addEventListener('click', function(e) { | 73 backButton.addEventListener('click', function(e) { |
| 55 chrome.send('eulaOnExit', [false, $('usage-stats').checked]); | 74 chrome.send('eulaOnExit', |
| 75 [false, $('usage-stats').checked, $('rlz-enable').checked]); | |
| 56 e.stopPropagation(); | 76 e.stopPropagation(); |
| 57 }); | 77 }); |
| 58 buttons.push(backButton); | 78 buttons.push(backButton); |
| 59 | 79 |
| 60 var acceptButton = this.ownerDocument.createElement('button'); | 80 var acceptButton = this.ownerDocument.createElement('button'); |
| 61 acceptButton.id = 'accept-button'; | 81 acceptButton.id = 'accept-button'; |
| 62 acceptButton.textContent = localStrings.getString('acceptAgreement'); | 82 acceptButton.textContent = localStrings.getString('acceptAgreement'); |
| 63 acceptButton.addEventListener('click', function(e) { | 83 acceptButton.addEventListener('click', function(e) { |
| 64 chrome.send('eulaOnExit', [true, $('usage-stats').checked]); | 84 $('eula').classList.add('loading'); // Mark EULA screen busy. |
| 85 chrome.send('eulaOnExit', | |
| 86 [true, $('usage-stats').checked, $('rlz-enable').checked]); | |
| 65 e.stopPropagation(); | 87 e.stopPropagation(); |
| 66 }); | 88 }); |
| 67 buttons.push(acceptButton); | 89 buttons.push(acceptButton); |
| 68 | 90 |
| 69 return buttons; | 91 return buttons; |
| 70 }, | 92 }, |
| 71 | 93 |
| 72 /** | 94 /** |
| 73 * Updates localized content of the screen that is not updated via template. | 95 * Updates localized content of the screen that is not updated via template. |
| 74 */ | 96 */ |
| 75 updateLocalizedContent: function() { | 97 updateLocalizedContent: function() { |
| 76 if ($('cros-eula-frame').src != '') | 98 if ($('cros-eula-frame').src != '') |
| 77 $('cros-eula-frame').src = $('cros-eula-frame').src; | 99 $('cros-eula-frame').src = $('cros-eula-frame').src; |
| 78 if ($('oem-eula-frame').src != '') | 100 if ($('oem-eula-frame').src != '') |
| 79 $('oem-eula-frame').src = $('oem-eula-frame').src; | 101 $('oem-eula-frame').src = $('oem-eula-frame').src; |
| 80 } | 102 } |
| 81 }; | 103 }; |
| 82 | 104 |
| 83 return { | 105 return { |
| 84 EulaScreen: EulaScreen | 106 EulaScreen: EulaScreen |
| 85 }; | 107 }; |
| 86 }); | 108 }); |
| OLD | NEW |