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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 Terms of Service screen implementation. 6 * @fileoverview Oobe Terms of Service screen implementation.
7 */ 7 */
8 8
9 cr.define('oobe', function() { 9 cr.define('oobe', function() {
10 /** 10 /**
(...skipping 19 matching lines...) Expand all
30 */ 30 */
31 TermsOfServiceScreen.setDomain = function(domain) { 31 TermsOfServiceScreen.setDomain = function(domain) {
32 $('tos-heading').textContent = 32 $('tos-heading').textContent =
33 localStrings.getStringF('termsOfServiceScreenHeading', domain); 33 localStrings.getStringF('termsOfServiceScreenHeading', domain);
34 $('tos-subheading').textContent = 34 $('tos-subheading').textContent =
35 localStrings.getStringF('termsOfServiceScreenSubheading', domain); 35 localStrings.getStringF('termsOfServiceScreenSubheading', domain);
36 $('tos-content-heading').textContent = 36 $('tos-content-heading').textContent =
37 localStrings.getStringF('termsOfServiceContentHeading', domain); 37 localStrings.getStringF('termsOfServiceContentHeading', domain);
38 }; 38 };
39 39
40 /**
41 * Displays the given |termsOfService|, enables the accept button and moves
42 * the focus to it.
43 * @param {string} termsOfService The terms of service, as plain text.
44 */
45 TermsOfServiceScreen.setTermsOfService = function(termsOfService) {
46 $('terms-of-service').classList.remove('tos-loading');
47 $('tos-content-main').textContent = termsOfService;
48 $('tos-accept-button').disabled = false;
49 // Initially, the back button is focused and the accept button is disabled.
50 // Move the focus to the accept button now but only if the user has not
51 // moved the focus anywhere in the meantime.
52 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
53 $('tos-accept-button').focus();
54 };
55
40 TermsOfServiceScreen.prototype = { 56 TermsOfServiceScreen.prototype = {
41 // Set up the prototype chain. 57 // Set up the prototype chain.
42 __proto__: HTMLDivElement.prototype, 58 __proto__: HTMLDivElement.prototype,
43 59
44 /** @override */ 60 /** @override */
45 decorate: function() { 61 decorate: function() {
46 }, 62 },
47 63
48 /** 64 /**
49 * Buttons in Oobe wizard's button strip. 65 * Buttons in Oobe wizard's button strip.
50 * @type {array} Array of Buttons. 66 * @type {array} Array of Buttons.
51 */ 67 */
52 get buttons() { 68 get buttons() {
53 var buttons = []; 69 var buttons = [];
54 70
55 var backButton = this.ownerDocument.createElement('button'); 71 var backButton = this.ownerDocument.createElement('button');
56 backButton.id = 'tos-back-button'; 72 backButton.id = 'tos-back-button';
57 backButton.textContent = 73 backButton.textContent =
58 localStrings.getString('termsOfServiceBackButton'); 74 localStrings.getString('termsOfServiceBackButton');
59 backButton.addEventListener('click', function(event) { 75 backButton.addEventListener('click', function(event) {
60 $('tos-back-button').disabled = true; 76 $('tos-back-button').disabled = true;
61 $('tos-accept-button').disabled = true; 77 $('tos-accept-button').disabled = true;
62 chrome.send('termsOfServiceBack'); 78 chrome.send('termsOfServiceBack');
63 }); 79 });
80 backButton.addEventListener('blur', function(event) {
81 this.blurred = true;
82 });
64 buttons.push(backButton); 83 buttons.push(backButton);
65 84
66 var acceptButton = this.ownerDocument.createElement('button'); 85 var acceptButton = this.ownerDocument.createElement('button');
67 acceptButton.id = 'tos-accept-button'; 86 acceptButton.id = 'tos-accept-button';
68 acceptButton.disabled = true; 87 acceptButton.disabled = true;
69 acceptButton.classList.add('preserve-disabled-state'); 88 acceptButton.classList.add('preserve-disabled-state');
70 acceptButton.textContent = 89 acceptButton.textContent =
71 localStrings.getString('termsOfServiceAcceptButton'); 90 localStrings.getString('termsOfServiceAcceptButton');
72 acceptButton.addEventListener('click', function(event) { 91 acceptButton.addEventListener('click', function(event) {
73 $('tos-back-button').disabled = true; 92 $('tos-back-button').disabled = true;
74 $('tos-accept-button').disabled = true; 93 $('tos-accept-button').disabled = true;
75 chrome.send('termsOfServiceAccept'); 94 chrome.send('termsOfServiceAccept');
76 }); 95 });
77 buttons.push(acceptButton); 96 buttons.push(acceptButton);
78 97
79 return buttons; 98 return buttons;
80 }, 99 },
81 100
82 /** 101 /**
102 * Returns the control which should receive initial focus.
103 */
104 get defaultControl() {
105 return $('tos-accept-button').disabled ? $('tos-back-button') :
106 $('tos-accept-button');
107 },
108
109 /**
83 * Event handler that is invoked just before the screen is shown. 110 * Event handler that is invoked just before the screen is shown.
84 * @param {object} data Screen init payload. 111 * @param {object} data Screen init payload.
85 */ 112 */
86 onBeforeShow: function(data) { 113 onBeforeShow: function(data) {
87 Oobe.getInstance().headerHidden = true; 114 Oobe.getInstance().headerHidden = true;
88 }, 115 },
89 }; 116 };
90 117
91 return { 118 return {
92 TermsOfServiceScreen: TermsOfServiceScreen 119 TermsOfServiceScreen: TermsOfServiceScreen
93 }; 120 };
94 }); 121 });
OLDNEW
« 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