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 /** | |
6 * The type of the app data object. The definition is based on | |
7 * chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc: | |
8 * PopulateAppDict() | |
9 * @typedef {{id: string, | |
10 * name: string, | |
11 * iconURL: string, | |
12 * autoLaunch: boolean, | |
13 * isLoading: boolean}} | |
14 */ | |
15 var AppDict; | |
16 | |
17 cr.define('extensions', function() { | 5 cr.define('extensions', function() { |
18 /** @const */ var List = cr.ui.List; | 6 /** @const */ var List = cr.ui.List; |
19 /** @const */ var ListItem = cr.ui.ListItem; | 7 /** @const */ var ListItem = cr.ui.ListItem; |
20 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
21 | 9 |
22 /** | 10 /** |
23 * Creates a list for showing kiosk apps. | 11 * Creates a list for showing kiosk apps. |
24 * @constructor | 12 * @constructor |
25 * @extends {cr.ui.List} | 13 * @extends {cr.ui.List} |
26 */ | 14 */ |
(...skipping 27 matching lines...) Expand all Loading... |
54 /** | 42 /** |
55 * Loads the given list of apps. | 43 * Loads the given list of apps. |
56 * @param {!Array.<!Object>} apps An array of app info objects. | 44 * @param {!Array.<!Object>} apps An array of app info objects. |
57 */ | 45 */ |
58 setApps: function(apps) { | 46 setApps: function(apps) { |
59 this.dataModel = new ArrayDataModel(apps); | 47 this.dataModel = new ArrayDataModel(apps); |
60 }, | 48 }, |
61 | 49 |
62 /** | 50 /** |
63 * Updates the given app. | 51 * Updates the given app. |
64 * @param {!AppDict} app An app info object. | 52 * @param {!Object} app An app info object. |
65 */ | 53 */ |
66 updateApp: function(app) { | 54 updateApp: function(app) { |
67 for (var i = 0; i < this.items.length; ++i) { | 55 for (var i = 0; i < this.items.length; ++i) { |
68 if (this.items[i].data.id == app.id) { | 56 if (this.items[i].data.id == app.id) { |
69 this.items[i].data = app; | 57 this.items[i].data = app; |
70 break; | 58 break; |
71 } | 59 } |
72 } | 60 } |
73 } | 61 } |
74 }; | 62 }; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 this.icon.style.backgroundImage = 'url(' + this.data.iconURL + ')'; | 148 this.icon.style.backgroundImage = 'url(' + this.data.iconURL + ')'; |
161 | 149 |
162 this.name.textContent = this.data.name || this.data.id; | 150 this.name.textContent = this.data.name || this.data.id; |
163 this.status.textContent = this.data.autoLaunch ? | 151 this.status.textContent = this.data.autoLaunch ? |
164 loadTimeData.getString('autoLaunch') : ''; | 152 loadTimeData.getString('autoLaunch') : ''; |
165 | 153 |
166 this.autoLaunch = this.data.autoLaunch; | 154 this.autoLaunch = this.data.autoLaunch; |
167 } | 155 } |
168 }; | 156 }; |
169 | 157 |
170 /** | 158 /* |
171 * True if the app represented by this item will auto launch. | 159 * True if the app represented by this item will auto launch. |
| 160 * @type {boolean} |
172 */ | 161 */ |
173 cr.defineProperty(KioskAppListItem, 'autoLaunch', cr.PropertyKind.BOOL_ATTR); | 162 cr.defineProperty(KioskAppListItem, 'autoLaunch', cr.PropertyKind.BOOL_ATTR); |
174 | 163 |
175 // Export | 164 // Export |
176 return { | 165 return { |
177 KioskAppList: KioskAppList | 166 KioskAppList: KioskAppList |
178 }; | 167 }; |
179 }); | 168 }); |
OLD | NEW |