OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 App install/launch splash screen implementation. | 6 * @fileoverview App install/launch splash screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('AppLaunchSplashScreen', 'app-launch-splash', function() { | 9 login.createScreen('AppLaunchSplashScreen', 'app-launch-splash', function() { |
10 return { | 10 return { |
11 EXTERNAL_API: [ | 11 EXTERNAL_API: [ |
12 'toggleNetworkConfig', | 12 'toggleNetworkConfig', |
13 'updateApp', | 13 'updateApp', |
14 'updateMessage', | 14 'updateMessage', |
15 ], | 15 ], |
16 | 16 |
17 /** @override */ | 17 /** @override */ |
18 decorate: function() { | 18 decorate: function() { |
19 $('splash-config-network').addEventListener('click', function(e) { | 19 $('splash-config-network').addEventListener('click', function(e) { |
20 chrome.send('configureNetwork'); | 20 chrome.send('configureNetwork'); |
21 }); | 21 }); |
22 | 22 |
23 var networkContainer = $('splash-config-network-container'); | 23 var networkContainer = $('splash-config-network-container'); |
24 networkContainer.addEventListener( | 24 networkContainer.addEventListener('transitionend', function(e) { |
25 'transitionend', | 25 if (this.classList.contains('faded')) |
26 function(e) { | 26 $('splash-config-network').hidden = true; |
27 if (this.classList.contains('faded')) | 27 }.bind(networkContainer)); |
28 $('splash-config-network').hidden = true; | |
29 }.bind(networkContainer) | |
30 ); | |
31 | 28 |
32 // Ensure the transitionend event gets called after a wait time. | 29 // Ensure the transitionend event gets called after a wait time. |
33 // The wait time should be inline with the transition duration time | 30 // 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 | 31 // defined in css file. The current value in css is 1000ms. To avoid |
35 // the emulated transitionend firing before real one, a 1050ms | 32 // the emulated transitionend firing before real one, a 1050ms |
36 // delay is used. | 33 // delay is used. |
37 ensureTransitionEndEvent(networkContainer, 1050); | 34 ensureTransitionEndEvent(networkContainer, 1050); |
38 }, | 35 }, |
39 | 36 |
40 /** | 37 /** |
41 * Event handler that is invoked just before the frame is shown. | 38 * Event handler that is invoked just before the frame is shown. |
42 * @param {string} data Screen init payload. | 39 * @param {string} data Screen init payload. |
43 */ | 40 */ |
44 onBeforeShow: function(data) { | 41 onBeforeShow: function(data) { |
45 $('splash-config-network').hidden = true; | 42 $('splash-config-network').hidden = true; |
46 this.toggleNetworkConfig(false); | 43 this.toggleNetworkConfig(false); |
47 this.updateApp(data['appInfo']); | 44 this.updateApp(data['appInfo']); |
48 | 45 |
49 $('splash-shortcut-info').hidden = !data['shortcutEnabled']; | 46 $('splash-shortcut-info').hidden = !data['shortcutEnabled']; |
50 | 47 |
51 Oobe.getInstance().headerHidden = true; | 48 Oobe.getInstance().headerHidden = true; |
52 Oobe.getInstance().solidBackground = true; | 49 Oobe.getInstance().solidBackground = true; |
53 }, | 50 }, |
54 | 51 |
55 /** | 52 /** |
56 * Event handler that is invoked just before the frame is hidden. | 53 * Event handler that is invoked just before the frame is hidden. |
57 */ | 54 */ |
58 onBeforeHide: function() { | 55 onBeforeHide: function() {}, |
59 }, | |
60 | 56 |
61 /** | 57 /** |
62 * Toggles visibility of the network configuration option. | 58 * Toggles visibility of the network configuration option. |
63 * @param {boolean} visible Whether to show the option. | 59 * @param {boolean} visible Whether to show the option. |
64 */ | 60 */ |
65 toggleNetworkConfig: function(visible) { | 61 toggleNetworkConfig: function(visible) { |
66 var container = $('splash-config-network-container'); | 62 var container = $('splash-config-network-container'); |
67 var currVisible = !container.classList.contains('faded'); | 63 var currVisible = !container.classList.contains('faded'); |
68 if (currVisible == visible) | 64 if (currVisible == visible) |
69 return; | 65 return; |
(...skipping 17 matching lines...) Expand all Loading... |
87 | 83 |
88 /** | 84 /** |
89 * Updates the message for the current launch state. | 85 * Updates the message for the current launch state. |
90 * @param {string} message Description for current launch state. | 86 * @param {string} message Description for current launch state. |
91 */ | 87 */ |
92 updateMessage: function(message) { | 88 updateMessage: function(message) { |
93 $('splash-launch-text').textContent = message; | 89 $('splash-launch-text').textContent = message; |
94 } | 90 } |
95 }; | 91 }; |
96 }); | 92 }); |
OLD | NEW |