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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 if (!this.confirmDiagnosticMode_) { | 103 if (!this.confirmDiagnosticMode_) { |
104 this.confirmDiagnosticMode_ = | 104 this.confirmDiagnosticMode_ = |
105 new cr.ui.dialogs.ConfirmDialog(document.body); | 105 new cr.ui.dialogs.ConfirmDialog(document.body); |
106 this.confirmDiagnosticMode_.setOkLabel( | 106 this.confirmDiagnosticMode_.setOkLabel( |
107 loadTimeData.getString('confirmKioskAppDiagnosticModeYes')); | 107 loadTimeData.getString('confirmKioskAppDiagnosticModeYes')); |
108 this.confirmDiagnosticMode_.setCancelLabel( | 108 this.confirmDiagnosticMode_.setCancelLabel( |
109 loadTimeData.getString('confirmKioskAppDiagnosticModeNo')); | 109 loadTimeData.getString('confirmKioskAppDiagnosticModeNo')); |
110 } | 110 } |
111 | 111 |
112 this.confirmDiagnosticMode_.show( | 112 this.confirmDiagnosticMode_.show( |
113 loadTimeData.getStringF('confirmKioskAppDiagnosticModeFormat', | 113 loadTimeData.getStringF( |
114 app.label), | 114 'confirmKioskAppDiagnosticModeFormat', app.label), |
115 function() { | 115 function() { |
116 chrome.send('launchKioskApp', [app.id, true]); | 116 chrome.send('launchKioskApp', [app.id, true]); |
117 }); | 117 }); |
118 }, | 118 }, |
119 | 119 |
120 /** | 120 /** |
121 * Adds an app to the menu. | 121 * Adds an app to the menu. |
122 * @param {Object} app An app info object. | 122 * @param {Object} app An app info object. |
123 * @private | 123 * @private |
124 */ | 124 */ |
(...skipping 18 matching lines...) Expand all Loading... |
143 chrome.send('kioskAppsLoaded'); | 143 chrome.send('kioskAppsLoaded'); |
144 }; | 144 }; |
145 | 145 |
146 /** | 146 /** |
147 * Shows the given error message. | 147 * Shows the given error message. |
148 * @param {!string} message Error message to show. | 148 * @param {!string} message Error message to show. |
149 */ | 149 */ |
150 AppsMenuButton.showError = function(message) { | 150 AppsMenuButton.showError = function(message) { |
151 /** @const */ var BUBBLE_OFFSET = 25; | 151 /** @const */ var BUBBLE_OFFSET = 25; |
152 /** @const */ var BUBBLE_PADDING = 12; | 152 /** @const */ var BUBBLE_PADDING = 12; |
153 $('bubble').showTextForElement($('show-apps-button'), | 153 $('bubble').showTextForElement( |
154 message, | 154 $('show-apps-button'), message, cr.ui.Bubble.Attachment.TOP, |
155 cr.ui.Bubble.Attachment.TOP, | 155 BUBBLE_OFFSET, BUBBLE_PADDING); |
156 BUBBLE_OFFSET, | |
157 BUBBLE_PADDING); | |
158 }; | 156 }; |
159 | 157 |
160 | 158 |
161 /** | 159 /** |
162 * Runs app with a given id from the list of loaded apps. | 160 * Runs app with a given id from the list of loaded apps. |
163 * @param {!string} id of an app to run. | 161 * @param {!string} id of an app to run. |
164 * @param {boolean=} opt_diagnostic_mode Whether to run the app in diagnostic | 162 * @param {boolean=} opt_diagnostic_mode Whether to run the app in diagnostic |
165 * mode. Default is false. | 163 * mode. Default is false. |
166 */ | 164 */ |
167 AppsMenuButton.runAppForTesting = function(id, opt_diagnostic_mode) { | 165 AppsMenuButton.runAppForTesting = function(id, opt_diagnostic_mode) { |
168 $('show-apps-button').findAndRunAppForTesting(id, opt_diagnostic_mode); | 166 $('show-apps-button').findAndRunAppForTesting(id, opt_diagnostic_mode); |
169 }; | 167 }; |
170 | 168 |
171 return { | 169 return {AppsMenuButton: AppsMenuButton}; |
172 AppsMenuButton: AppsMenuButton | |
173 }; | |
174 }); | 170 }); |
OLD | NEW |