Index: chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js |
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js b/chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js |
index b2769605168cd9e1fd4d648d772de036fb5bd848..8776629aad3d140507e3604f19402853b6548950 100644 |
--- a/chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js |
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js |
@@ -37,6 +37,22 @@ cr.define('oobe', function() { |
localStrings.getStringF('termsOfServiceContentHeading', domain); |
}; |
+ /** |
+ * Displays the given |termsOfService|, enables the accept button and moves |
+ * the focus to it. |
+ * @param {string} termsOfService The terms of service, as plain text. |
+ */ |
+ TermsOfServiceScreen.setTermsOfService = function(termsOfService) { |
+ $('terms-of-service').classList.remove('tos-loading'); |
+ $('tos-content-main').textContent = termsOfService; |
+ $('tos-accept-button').disabled = false; |
+ // Initially, the back button is focused and the accept button is disabled. |
+ // Move the focus to the accept button now but only if the user has not |
+ // moved the focus anywhere in the meantime. |
+ if (!$('tos-back-button').blurred) |
Nikita (slow)
2013/02/12 20:51:48
nit: You could check what's the current document.a
bartfab (slow)
2013/02/12 23:22:59
The property actually is needed to achieve the sem
|
+ $('tos-accept-button').focus(); |
+ }; |
+ |
TermsOfServiceScreen.prototype = { |
// Set up the prototype chain. |
__proto__: HTMLDivElement.prototype, |
@@ -61,6 +77,9 @@ cr.define('oobe', function() { |
$('tos-accept-button').disabled = true; |
chrome.send('termsOfServiceBack'); |
}); |
+ backButton.addEventListener('blur', function(event) { |
+ this.blurred = true; |
+ }); |
buttons.push(backButton); |
var acceptButton = this.ownerDocument.createElement('button'); |
@@ -80,6 +99,14 @@ cr.define('oobe', function() { |
}, |
/** |
+ * Returns the control which should receive initial focus. |
+ */ |
+ get defaultControl() { |
+ return $('tos-accept-button').disabled ? $('tos-back-button') : |
+ $('tos-accept-button'); |
+ }, |
+ |
+ /** |
* Event handler that is invoked just before the screen is shown. |
* @param {object} data Screen init payload. |
*/ |