Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/resources/extensions/chromeos/kiosk_app_list.js

Issue 130613004: Enabled consumer kiosk mode for all. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 cr.define('extensions', function() { 5 cr.define('extensions', function() {
6 /** @const */ var List = cr.ui.List; 6 /** @const */ var List = cr.ui.List;
7 /** @const */ var ListItem = cr.ui.ListItem; 7 /** @const */ var ListItem = cr.ui.ListItem;
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 /** 10 /**
11 * Creates a list for showing kiosk apps. 11 * Creates a list for showing kiosk apps.
12 * @constructor 12 * @constructor
13 * @extends {cr.ui.List} 13 * @extends {cr.ui.List}
14 */ 14 */
15 var KioskAppList = cr.ui.define('list'); 15 var KioskAppList = cr.ui.define('list');
16 16
17 KioskAppList.prototype = { 17 KioskAppList.prototype = {
18 __proto__: List.prototype, 18 __proto__: List.prototype,
19 19
20 /**
21 * True if auto launch feature can be configured.
22 * @type {?boolean}
23 */
24 autoLaunchEnabled_: false,
25
20 /** @override */ 26 /** @override */
21 createItem: function(app) { 27 createItem: function(app) {
22 var item = new KioskAppListItem(); 28 var item = new KioskAppListItem();
23 item.data = app; 29 item.data = app;
24 return item; 30 return item;
25 }, 31 },
26 32
27 /** 33 /**
28 * Loads the given list of apps. 34 * Loads the given list of apps.
29 * @param {!Array.<!Object>} apps An array of app info objects. 35 * @param {!Array.<!Object>} apps An array of app info objects.
30 */ 36 */
37 setAutoLaunchEnabled: function(enabled) {
38 this.autoLaunchEnabled_ = enabled;
39 },
40
41 /**
42 * Loads the given list of apps.
43 * @param {!Array.<!Object>} apps An array of app info objects.
44 */
31 setApps: function(apps) { 45 setApps: function(apps) {
32 this.dataModel = new ArrayDataModel(apps); 46 this.dataModel = new ArrayDataModel(apps);
33 }, 47 },
34 48
35 /** 49 /**
36 * Updates the given app. 50 * Updates the given app.
37 * @param {!Object} app An app info object. 51 * @param {!Object} app An app info object.
38 */ 52 */
39 updateApp: function(app) { 53 updateApp: function(app) {
40 for (var i = 0; i < this.items.length; ++i) { 54 for (var i = 0; i < this.items.length; ++i) {
41 if (this.items[i].data.id == app.id) { 55 if (this.items[i].data.id == app.id) {
42 this.items[i].data = app; 56 this.items[i].data = app;
57 this.items[i].data.autoLaunchEnabled_ = this.autoLaunchEnabled_;
43 break; 58 break;
44 } 59 }
45 } 60 }
46 } 61 }
47 }; 62 };
48 63
49 /** 64 /**
50 * Creates a list item for a kiosk app. 65 * Creates a list item for a kiosk app.
51 * @constructor 66 * @constructor
52 * @extends {cr.ui.ListItem} 67 * @extends {cr.ui.ListItem}
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 /** @override */ 118 /** @override */
104 decorate: function() { 119 decorate: function() {
105 ListItem.prototype.decorate.call(this); 120 ListItem.prototype.decorate.call(this);
106 121
107 var sendMessageWithId = function(msg) { 122 var sendMessageWithId = function(msg) {
108 return function() { 123 return function() {
109 chrome.send(msg, [this.data.id]); 124 chrome.send(msg, [this.data.id]);
110 }.bind(this); 125 }.bind(this);
111 }.bind(this); 126 }.bind(this);
112 127
113 this.querySelector('.enable-auto-launch-button').onclick = 128 if (this.autoLaunchEnabled_) {
114 sendMessageWithId('enableKioskAutoLaunch'); 129 this.querySelector('.enable-auto-launch-button').onclick =
115 this.querySelector('.disable-auto-launch-button').onclick = 130 sendMessageWithId('enableKioskAutoLaunch');
116 sendMessageWithId('disableKioskAutoLaunch'); 131 this.querySelector('.disable-auto-launch-button').onclick =
132 sendMessageWithId('disableKioskAutoLaunch');
133 } else {
134 this.querySelector('.enable-auto-launch-button').hidden = true;
135 this.querySelector('.disable-auto-launch-button').hidden = true;
136 }
137
117 this.querySelector('.row-delete-button').onclick = 138 this.querySelector('.row-delete-button').onclick =
118 sendMessageWithId('removeKioskApp'); 139 sendMessageWithId('removeKioskApp');
119 }, 140 },
120 141
121 /** 142 /**
122 * Updates UI from app info data. 143 * Updates UI from app info data.
123 */ 144 */
124 redraw: function() { 145 redraw: function() {
125 this.icon.classList.toggle('spinner', this.data.isLoading); 146 this.icon.classList.toggle('spinner', this.data.isLoading);
126 this.icon.style.backgroundImage = 'url(' + this.data.iconURL + ')'; 147 this.icon.style.backgroundImage = 'url(' + this.data.iconURL + ')';
(...skipping 10 matching lines...) Expand all
137 * True if the app represented by this item will auto launch. 158 * True if the app represented by this item will auto launch.
138 * @type {boolean} 159 * @type {boolean}
139 */ 160 */
140 cr.defineProperty(KioskAppListItem, 'autoLaunch', cr.PropertyKind.BOOL_ATTR); 161 cr.defineProperty(KioskAppListItem, 'autoLaunch', cr.PropertyKind.BOOL_ATTR);
141 162
142 // Export 163 // Export
143 return { 164 return {
144 KioskAppList: KioskAppList 165 KioskAppList: KioskAppList
145 }; 166 };
146 }); 167 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698