OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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('apps_dev_tool', function() { | 5 cr.define('apps_dev_tool', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 // The list of all apps & extensions. | 8 // The list of all apps & extensions & unpacked. |
Gaurav
2013/05/23 17:13:24
May be
"The list of all packed/unpacked apps and
dvh
2013/05/23 18:07:23
Done.
| |
9 var completeList = []; | 9 var completeList = []; |
10 | 10 |
11 // The list of all apps. | 11 // The list of all apps. |
Gaurav
2013/05/23 17:13:24
This doesn't include unpacked rgt ?
May be:
inst
dvh
2013/05/23 18:07:23
I use packedExtensionList, same apply to packedApp
| |
12 var appList = []; | 12 var appList = []; |
13 | 13 |
14 // The list of all extensions. | 14 // The list of all extensions. |
15 var extensionList = []; | 15 var extensionList = []; |
Gaurav
2013/05/23 17:13:24
as above
dvh
2013/05/23 18:07:23
Done.
| |
16 | 16 |
17 // The list of all unpacked apps or extensions. | |
18 var unpackedList = []; | |
19 | |
17 /** const*/ var AppsDevTool = apps_dev_tool.AppsDevTool; | 20 /** const*/ var AppsDevTool = apps_dev_tool.AppsDevTool; |
18 | 21 |
19 /** | 22 /** |
20 * @param {string} a first string. | 23 * @param {string} a first string. |
21 * @param {string} b second string. | 24 * @param {string} b second string. |
22 * @return {number} 1, 0, -1 if |a| is lexicographically greater, equal or | 25 * @return {number} 1, 0, -1 if |a| is lexicographically greater, equal or |
23 * lesser than |b| respectively. | 26 * lesser than |b| respectively. |
24 */ | 27 */ |
25 function compare(a, b) { | 28 function compare(a, b) { |
26 return a > b ? 1 : (a == b ? 0 : -1); | 29 return a > b ? 1 : (a == b ? 0 : -1); |
(...skipping 18 matching lines...) Expand all Loading... | |
45 * @param {string} app2 second app_name. | 48 * @param {string} app2 second app_name. |
46 */ | 49 */ |
47 function compareByName(app1, app2) { | 50 function compareByName(app1, app2) { |
48 return compare(app1.name.toLowerCase(), app2.name.toLowerCase()); | 51 return compare(app1.name.toLowerCase(), app2.name.toLowerCase()); |
49 } | 52 } |
50 | 53 |
51 /** | 54 /** |
52 * Refreshes the app. | 55 * Refreshes the app. |
53 */ | 56 */ |
54 function reloadAppDisplay() { | 57 function reloadAppDisplay() { |
55 var extensions = new ItemsList($('extension-settings-list'), extensionList); | 58 var extensions = new ItemsList($('extension-settings-list'), extensionList); |
dvh
2013/05/23 18:07:23
I renamed the element id too.
| |
56 var apps = new ItemsList($('app-settings-list'), appList); | 59 var apps = new ItemsList($('app-settings-list'), appList); |
60 var unpacked = new ItemsList($('unpacked-settings-list'), unpackedList); | |
57 extensions.showItemNodes(); | 61 extensions.showItemNodes(); |
58 apps.showItemNodes(); | 62 apps.showItemNodes(); |
63 unpacked.showItemNodes(); | |
59 } | 64 } |
60 | 65 |
61 /** | 66 /** |
62 * Applies the given |filter| to the items list. | 67 * Applies the given |filter| to the items list. |
63 * @param {string} filter Curent string in the search box. | 68 * @param {string} filter Curent string in the search box. |
64 */ | 69 */ |
65 function rebuildAppList(filter) { | 70 function rebuildAppList(filter) { |
66 appList = []; | 71 appList = []; |
67 extensionList = []; | 72 extensionList = []; |
73 unpackedList = []; | |
68 | 74 |
69 for (var i = 0; i < completeList.length; i++) { | 75 for (var i = 0; i < completeList.length; i++) { |
70 var item = completeList[i]; | 76 var item = completeList[i]; |
71 if (filter && item.name.toLowerCase().search(filter.toLowerCase()) < 0) | 77 if (filter && item.name.toLowerCase().search(filter.toLowerCase()) < 0) |
72 continue; | 78 continue; |
73 if (item.isApp) | 79 if (item.is_unpacked) |
80 unpackedList.push(item); | |
81 else if (item.isApp) | |
74 appList.push(item); | 82 appList.push(item); |
75 else | 83 else |
76 extensionList.push(item); | 84 extensionList.push(item); |
77 } | 85 } |
78 } | 86 } |
79 | 87 |
80 /** | 88 /** |
81 * Create item nodes from the metadata. | 89 * Create item nodes from the metadata. |
82 * @constructor | 90 * @constructor |
83 */ | 91 */ |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 ItemsList.launchApp = function(id) { | 429 ItemsList.launchApp = function(id) { |
422 chrome.management.launchApp(id, function() { | 430 chrome.management.launchApp(id, function() { |
423 ItemsList.loadItemsInfo(); | 431 ItemsList.loadItemsInfo(); |
424 }); | 432 }); |
425 }; | 433 }; |
426 | 434 |
427 return { | 435 return { |
428 ItemsList: ItemsList, | 436 ItemsList: ItemsList, |
429 }; | 437 }; |
430 }); | 438 }); |
OLD | NEW |