Remove the old signature of NotificationManager::closePersistent().
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / login / oobe_screen_autolaunch.js
blobed9fe639e256aa7da0e37c2b24d525af27064245
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.
5 /**
6 * @fileoverview Oobe reset screen implementation.
7 */
9 login.createScreen('AutolaunchScreen', 'autolaunch', function() {
10 return {
11 EXTERNAL_API: ['updateApp', 'confirmAutoLaunchForTesting'],
12 /**
13 * Header text of the screen.
14 * @type {string}
16 get header() {
17 return loadTimeData.getString('autolaunchTitle');
20 /**
21 * Buttons in oobe wizard's button strip.
22 * @type {array} Array of Buttons.
24 get buttons() {
25 var 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');
33 e.stopPropagation();
34 });
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');
43 e.stopPropagation();
44 });
45 buttons.push(cancelButton);
46 return buttons;
49 /**
50 * Event handler invoked when the page is shown and ready.
52 onBeforeShow: function() {
53 chrome.send('autolaunchVisible');
56 /**
57 * Returns a control which should receive an initial focus.
59 get defaultControl() {
60 return $('autolaunch-cancel-button');
63 /**
64 * Cancels the reset and drops the user back to the login screen.
66 cancel: function() {
67 chrome.send('autolaunchOnCancel');
70 /**
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;
81 /**
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);
93 });