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 App install/launch splash screen implementation.
9 login.createScreen('AppLaunchSplashScreen', 'app-launch-splash', function() {
12 'toggleNetworkConfig',
18 decorate: function() {
19 $('splash-config-network').addEventListener('click', function(e) {
20 chrome.send('configureNetwork');
23 var networkContainer = $('splash-config-network-container');
24 networkContainer.addEventListener(
25 'webkitTransitionEnd',
27 if (this.classList.contains('faded'))
28 $('splash-config-network').hidden = true;
29 }.bind(networkContainer)
32 // Ensure the webkitTransitionEnd event gets called after a wait time.
33 // The wait time should be inline with the transition duration time
34 // defined in css file. The current value in css is 1000ms. To avoid
35 // the emulated webkitTransitionEnd firing before real one, a 1050ms
37 ensureTransitionEndEvent(networkContainer, 1050);
41 * Event handler that is invoked just before the frame is shown.
42 * @param {string} data Screen init payload.
44 onBeforeShow: function(data) {
45 $('splash-config-network').hidden = true;
46 this.toggleNetworkConfig(false);
47 this.updateApp(data['appInfo']);
49 $('splash-shortcut-info').hidden = !data['shortcutEnabled'];
51 Oobe.getInstance().headerHidden = true;
52 Oobe.getInstance().solidBackground = true;
56 * Event handler that is invoked just before the frame is hidden.
58 onBeforeHide: function() {
62 * Toggles visibility of the network configuration option.
63 * @param {boolean} visible Whether to show the option.
65 toggleNetworkConfig: function(visible) {
66 var container = $('splash-config-network-container');
67 var currVisible = !container.classList.contains('faded');
68 if (currVisible == visible)
72 $('splash-config-network').hidden = false;
73 container.classList.remove('faded');
75 container.classList.add('faded');
80 * Updates the app name and icon.
81 * @param {Object} app Details of app being launched.
83 updateApp: function(app) {
84 $('splash-header').textContent = app.name;
85 $('splash-header').style.backgroundImage = 'url(' + app.iconURL + ')';
89 * Updates the message for the current launch state.
90 * @param {string} message Description for current launch state.
92 updateMessage: function(message) {
93 $('splash-launch-text').textContent = message;