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