1 // Copyright 2013 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.
6 * @fileoverview Oobe reset screen implementation.
9 login.createScreen('AutolaunchScreen', 'autolaunch', function() {
11 EXTERNAL_API: ['updateApp', 'confirmAutoLaunchForTesting'],
13 * Header text of the screen.
17 return loadTimeData.getString('autolaunchTitle');
21 * Buttons in oobe wizard's button strip.
22 * @type {array} Array of Buttons.
27 var confirmButton = this.ownerDocument.createElement('button');
28 confirmButton.id = 'autolaunch-confirm-button';
29 confirmButton.textContent =
30 loadTimeData.getString('autolaunchConfirmButton');
31 confirmButton.addEventListener('click', function(e) {
32 chrome.send('autolaunchOnConfirm');
35 buttons.push(confirmButton);
37 var cancelButton = this.ownerDocument.createElement('button');
38 cancelButton.id = 'autolaunch-cancel-button';
39 cancelButton.textContent =
40 loadTimeData.getString('autolaunchCancelButton');
41 cancelButton.addEventListener('click', function(e) {
42 chrome.send('autolaunchOnCancel');
45 buttons.push(cancelButton);
50 * Event handler invoked when the page is shown and ready.
52 onBeforeShow: function() {
53 chrome.send('autolaunchVisible');
57 * Returns a control which should receive an initial focus.
59 get defaultControl() {
60 return $('autolaunch-cancel-button');
64 * Cancels the reset and drops the user back to the login screen.
67 chrome.send('autolaunchOnCancel');
71 * Sets app to be displayed in the auto-launch warning.
72 * @param {!Object} app An dictionary with app info.
74 updateApp: function(app) {
75 if (app.appIconUrl && app.appIconUrl.length)
76 $('autolaunch-app-icon').src = app.appIconUrl;
78 $('autolaunch-app-name').innerText = app.appName;
82 * Initiates confirm/cancel response for testing.
83 * @param {boolean} confirm True if the screen should confirm auto-launch.
85 confirmAutoLaunchForTesting: function(confirm) {
86 var button = confirm ? $('autolaunch-confirm-button') :
87 $('autolaunch-cancel-button');
88 var clickEvent = cr.doc.createEvent('Event');
89 clickEvent.initEvent('click', true, true);
90 button.dispatchEvent(clickEvent);