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

Side by Side Diff: chrome/browser/resources/chromeos/login/oobe_screen_eula.js

Issue 755203002: Added usage of ScreenContext in EulaScreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments. Created 6 years 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
OLDNEW
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';
11
10 return { 12 return {
11 /** @override */ 13 /** @override */
12 decorate: function() { 14 decorate: function() {
13 $('eula-chrome-credits-link').hidden = true; 15 $('eula-chrome-credits-link').hidden = true;
14 $('eula-chromeos-credits-link').hidden = true; 16 $('eula-chromeos-credits-link').hidden = true;
15 $('stats-help-link').addEventListener('click', function(event) { 17 $('stats-help-link').addEventListener('click', function(event) {
16 chrome.send('eulaOnLearnMore'); 18 chrome.send('eulaOnLearnMore');
17 }); 19 });
18 $('installation-settings-link').addEventListener( 20 $('installation-settings-link').addEventListener(
19 'click', function(event) { 21 'click', function(event) {
20 chrome.send('eulaOnInstallationSettingsPopupOpened'); 22 chrome.send('eulaOnInstallationSettingsPopupOpened');
21 $('popup-overlay').hidden = false; 23 $('popup-overlay').hidden = false;
22 $('installation-settings-ok-button').focus(); 24 $('installation-settings-ok-button').focus();
23 }); 25 });
24 $('installation-settings-ok-button').addEventListener( 26 $('installation-settings-ok-button').addEventListener(
25 'click', function(event) { 27 'click', function(event) {
26 $('popup-overlay').hidden = true; 28 $('popup-overlay').hidden = true;
27 }); 29 });
28 // Do not allow focus leaving the overlay. 30 // Do not allow focus leaving the overlay.
29 $('popup-overlay').addEventListener('focusout', function(event) { 31 $('popup-overlay').addEventListener('focusout', function(event) {
30 // WebKit does not allow immediate focus return. 32 // WebKit does not allow immediate focus return.
31 window.setTimeout(function() { 33 window.setTimeout(function() {
32 // TODO(ivankr): focus cycling. 34 // TODO(ivankr): focus cycling.
33 $('installation-settings-ok-button').focus(); 35 $('installation-settings-ok-button').focus();
34 }, 0); 36 }, 0);
35 event.preventDefault(); 37 event.preventDefault();
36 }); 38 });
39
40 var self = this;
41 $('usage-stats').addEventListener('click', function(event) {
42 self.context.set(CONTEXT_KEY_USAGE_STATS_ENABLED,
43 $('usage-stats').checked);
44 self.commitContextChanges();
45 event.stopPropagation();
46 });
37 }, 47 },
38 48
39 /** 49 /**
40 * Event handler that is invoked when 'chrome://terms' is loaded. 50 * Event handler that is invoked when 'chrome://terms' is loaded.
41 */ 51 */
42 onFrameLoad: function() { 52 onFrameLoad: function() {
43 $('accept-button').disabled = false; 53 $('accept-button').disabled = false;
44 $('eula').classList.remove('eula-loading'); 54 $('eula').classList.remove('eula-loading');
45 // Initially, the back button is focused and the accept button is 55 // Initially, the back button is focused and the accept button is
46 // disabled. 56 // disabled.
(...skipping 25 matching lines...) Expand all
72 /** 82 /**
73 * Buttons in oobe wizard's button strip. 83 * Buttons in oobe wizard's button strip.
74 * @type {Array} Array of Buttons. 84 * @type {Array} Array of Buttons.
75 */ 85 */
76 get buttons() { 86 get buttons() {
77 var buttons = []; 87 var buttons = [];
78 88
79 var backButton = this.ownerDocument.createElement('button'); 89 var backButton = this.ownerDocument.createElement('button');
80 backButton.id = 'back-button'; 90 backButton.id = 'back-button';
81 backButton.textContent = loadTimeData.getString('back'); 91 backButton.textContent = loadTimeData.getString('back');
92
93 var self = this;
82 backButton.addEventListener('click', function(e) { 94 backButton.addEventListener('click', function(e) {
83 chrome.send('eulaOnExit', [false, $('usage-stats').checked]); 95 chrome.send('eulaBackButtonClicked');
84 e.stopPropagation(); 96 e.stopPropagation();
85 }); 97 });
86 buttons.push(backButton); 98 buttons.push(backButton);
87 99
88 var acceptButton = this.ownerDocument.createElement('button'); 100 var acceptButton = this.ownerDocument.createElement('button');
89 acceptButton.id = 'accept-button'; 101 acceptButton.id = 'accept-button';
90 acceptButton.disabled = true; 102 acceptButton.disabled = true;
91 acceptButton.classList.add('preserve-disabled-state'); 103 acceptButton.classList.add('preserve-disabled-state');
92 acceptButton.textContent = loadTimeData.getString('acceptAgreement'); 104 acceptButton.textContent = loadTimeData.getString('acceptAgreement');
93 acceptButton.addEventListener('click', function(e) { 105 acceptButton.addEventListener('click', function(e) {
94 $('eula').classList.add('loading'); // Mark EULA screen busy. 106 $('eula').classList.add('loading'); // Mark EULA screen busy.
95 chrome.send('eulaOnExit', [true, $('usage-stats').checked]); 107 chrome.send('eulaAcceptButtonClicked');
96 e.stopPropagation(); 108 e.stopPropagation();
97 }); 109 });
98 buttons.push(acceptButton); 110 buttons.push(acceptButton);
99 111
100 return buttons; 112 return buttons;
101 }, 113 },
102 114
103 /** 115 /**
104 * Returns a control which should receive an initial focus. 116 * Returns a control which should receive an initial focus.
105 */ 117 */
(...skipping 24 matching lines...) Expand all
130 if ($('cros-eula-frame').src) { 142 if ($('cros-eula-frame').src) {
131 $('cros-eula-frame').src = $('cros-eula-frame').src; 143 $('cros-eula-frame').src = $('cros-eula-frame').src;
132 } 144 }
133 if ($('oem-eula-frame').src) { 145 if ($('oem-eula-frame').src) {
134 $('oem-eula-frame').src = $('oem-eula-frame').src; 146 $('oem-eula-frame').src = $('oem-eula-frame').src;
135 } 147 }
136 } 148 }
137 }; 149 };
138 }); 150 });
139 151
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698