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 /** @override */ | 29 /** @override */ |
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. |
| 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 * Returns a control which should receive an initial focus. | 95 * Returns a control which should receive an initial focus. |
74 */ | 96 */ |
75 get defaultControl() { | 97 get defaultControl() { |
76 return $('accept-button'); | 98 return $('accept-button'); |
77 }, | 99 }, |
78 | 100 |
79 /** | 101 /** |
80 * Updates localized content of the screen that is not updated via template. | 102 * Updates localized content of the screen that is not updated via template. |
81 */ | 103 */ |
82 updateLocalizedContent: function() { | 104 updateLocalizedContent: function() { |
83 if ($('cros-eula-frame').src != '') | 105 if ($('cros-eula-frame').src != '') |
84 $('cros-eula-frame').src = $('cros-eula-frame').src; | 106 $('cros-eula-frame').src = $('cros-eula-frame').src; |
85 if ($('oem-eula-frame').src != '') | 107 if ($('oem-eula-frame').src != '') |
86 $('oem-eula-frame').src = $('oem-eula-frame').src; | 108 $('oem-eula-frame').src = $('oem-eula-frame').src; |
87 } | 109 } |
88 }; | 110 }; |
89 | 111 |
90 return { | 112 return { |
91 EulaScreen: EulaScreen | 113 EulaScreen: EulaScreen |
92 }; | 114 }; |
93 }); | 115 }); |
OLD | NEW |