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 Kiosk apps menu implementation. | 6 * @fileoverview Kiosk apps menu implementation. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('login', function() { | 9 cr.define('login', function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 }, | 54 }, |
55 | 55 |
56 /** @override */ | 56 /** @override */ |
57 showMenu: function(shouldSetFocus) { | 57 showMenu: function(shouldSetFocus) { |
58 if (this.needsRebuild_) { | 58 if (this.needsRebuild_) { |
59 this.menu.textContent = ''; | 59 this.menu.textContent = ''; |
60 this.data_.forEach(this.addItem_, this); | 60 this.data_.forEach(this.addItem_, this); |
61 this.needsRebuild_ = false; | 61 this.needsRebuild_ = false; |
62 } | 62 } |
63 | 63 |
64 MenuButton.prototype.showMenu.apply(this, arguments); | 64 if (this.data.length > 0) |
| 65 MenuButton.prototype.showMenu.apply(this, arguments); |
65 }, | 66 }, |
66 | 67 |
67 /** | 68 /** |
68 * Invoked when apps menu becomes visible. | 69 * Invoked when apps menu becomes visible. |
69 */ | 70 */ |
70 didShow: function() { | 71 didShow: function() { |
71 window.setTimeout(function() { | 72 window.setTimeout(function() { |
72 if (!$('apps-header-bar-item').hidden) | 73 if (!$('apps-header-bar-item').hidden) |
73 chrome.send('checkKioskAppLaunchError'); | 74 chrome.send('checkKioskAppLaunchError'); |
74 }, 500); | 75 }, 500); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 }.bind(this)); | 141 }.bind(this)); |
141 } | 142 } |
142 }; | 143 }; |
143 | 144 |
144 /** | 145 /** |
145 * Sets apps to be displayed in the apps menu. | 146 * Sets apps to be displayed in the apps menu. |
146 * @param {!Array.<!Object>} apps An array of app info objects. | 147 * @param {!Array.<!Object>} apps An array of app info objects. |
147 */ | 148 */ |
148 AppsMenuButton.setApps = function(apps) { | 149 AppsMenuButton.setApps = function(apps) { |
149 $('show-apps-button').data = apps; | 150 $('show-apps-button').data = apps; |
150 $('login-header-bar').hasApps = apps.length > 0; | 151 $('login-header-bar').hasApps = |
| 152 apps.length > 0 || loadTimeData.getBoolean('kioskAppHasLaunchError'); |
151 chrome.send('kioskAppsLoaded'); | 153 chrome.send('kioskAppsLoaded'); |
152 }; | 154 }; |
153 | 155 |
154 /** | 156 /** |
155 * Shows the given error message. | 157 * Shows the given error message. |
156 * @param {!string} message Error message to show. | 158 * @param {!string} message Error message to show. |
157 */ | 159 */ |
158 AppsMenuButton.showError = function(message) { | 160 AppsMenuButton.showError = function(message) { |
159 /** @const */ var BUBBLE_OFFSET = 25; | 161 /** @const */ var BUBBLE_OFFSET = 25; |
160 /** @const */ var BUBBLE_PADDING = 12; | 162 /** @const */ var BUBBLE_PADDING = 12; |
(...skipping 12 matching lines...) Expand all Loading... |
173 * mode. Default is false. | 175 * mode. Default is false. |
174 */ | 176 */ |
175 AppsMenuButton.runAppForTesting = function(id, opt_diagnostic_mode) { | 177 AppsMenuButton.runAppForTesting = function(id, opt_diagnostic_mode) { |
176 $('show-apps-button').findAndRunAppForTesting(id, opt_diagnostic_mode); | 178 $('show-apps-button').findAndRunAppForTesting(id, opt_diagnostic_mode); |
177 }; | 179 }; |
178 | 180 |
179 return { | 181 return { |
180 AppsMenuButton: AppsMenuButton | 182 AppsMenuButton: AppsMenuButton |
181 }; | 183 }; |
182 }); | 184 }); |
OLD | NEW |