cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / login / oobe_screen_eula.js
blobf6c85cc2cdf6f9be32ecec8b28b0c4d2afaef2fa
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
3 // found in the LICENSE file.
5 /**
6 * @fileoverview Oobe eula screen implementation.
7 */
9 login.createScreen('EulaScreen', 'eula', function() {
10 var CONTEXT_KEY_USAGE_STATS_ENABLED = 'usageStatsEnabled';
12 return {
13 /** @override */
14 decorate: function() {
15 $('eula-chrome-credits-link').hidden = true;
16 $('eula-chromeos-credits-link').hidden = true;
17 $('stats-help-link').addEventListener('click', function(event) {
18 chrome.send('eulaOnLearnMore');
19 });
20 $('installation-settings-link').addEventListener(
21 'click', function(event) {
22 chrome.send('eulaOnInstallationSettingsPopupOpened');
23 $('popup-overlay').hidden = false;
24 $('installation-settings-ok-button').focus();
25 });
26 $('installation-settings-ok-button').addEventListener(
27 'click', function(event) {
28 $('popup-overlay').hidden = true;
29 });
30 // Do not allow focus leaving the overlay.
31 $('popup-overlay').addEventListener('focusout', function(event) {
32 // WebKit does not allow immediate focus return.
33 window.setTimeout(function() {
34 // TODO(ivankr): focus cycling.
35 $('installation-settings-ok-button').focus();
36 }, 0);
37 event.preventDefault();
38 });
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 });
49 /**
50 * Event handler that is invoked when 'chrome://terms' is loaded.
52 onFrameLoad: function() {
53 $('accept-button').disabled = false;
54 $('eula').classList.remove('eula-loading');
55 // Initially, the back button is focused and the accept button is
56 // disabled.
57 // Move the focus to the accept button now but only if the user has not
58 // moved the focus anywhere in the meantime.
59 if (!$('back-button').blurred)
60 $('accept-button').focus();
63 /**
64 * Event handler that is invoked just before the screen is shown.
65 * @param {object} data Screen init payload.
67 onBeforeShow: function() {
68 $('eula').classList.add('eula-loading');
69 $('cros-eula-frame').onload = this.onFrameLoad;
70 $('accept-button').disabled = true;
71 $('cros-eula-frame').src = 'chrome://terms';
74 /**
75 * Header text of the screen.
76 * @type {string}
78 get header() {
79 return loadTimeData.getString('eulaScreenTitle');
82 /**
83 * Buttons in oobe wizard's button strip.
84 * @type {Array} Array of Buttons.
86 get buttons() {
87 var buttons = [];
89 var backButton = this.declareButton('back-button');
90 backButton.textContent = loadTimeData.getString('back');
91 buttons.push(backButton);
93 var acceptButton = this.declareButton('accept-button');
94 acceptButton.disabled = true;
95 acceptButton.classList.add('preserve-disabled-state');
96 acceptButton.textContent = loadTimeData.getString('acceptAgreement');
97 acceptButton.addEventListener('click', function(e) {
98 $('eula').classList.add('loading'); // Mark EULA screen busy.
99 Oobe.clearErrors();
100 e.stopPropagation();
102 buttons.push(acceptButton);
104 return buttons;
108 * Returns a control which should receive an initial focus.
110 get defaultControl() {
111 return $('accept-button').disabled ? $('back-button') :
112 $('accept-button');
115 enableKeyboardFlow: function() {
116 $('eula-chrome-credits-link').hidden = false;
117 $('eula-chromeos-credits-link').hidden = false;
118 $('eula-chrome-credits-link').addEventListener('click',
119 function(event) {
120 chrome.send('eulaOnChromeCredits');
122 $('eula-chromeos-credits-link').addEventListener('click',
123 function(event) {
124 chrome.send('eulaOnChromeOSCredits');
129 * Updates localized content of the screen that is not updated via template.
131 updateLocalizedContent: function() {
132 // Force iframes to refresh. It's only available method because we have
133 // no access to iframe.contentWindow.
134 if ($('cros-eula-frame').src) {
135 $('cros-eula-frame').src = $('cros-eula-frame').src;
137 if ($('oem-eula-frame').src) {
138 $('oem-eula-frame').src = $('oem-eula-frame').src;