Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1489)

Unified Diff: chrome/browser/resources/chromeos/login/oobe_screen_terms_of_service.js

Issue 12221143: Set default control on Terms of Service screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
*/
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698