OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** @constructor */ | 5 /** @constructor */ |
6 function TaskManager() { } | 6 function TaskManager() { } |
7 | 7 |
8 cr.addSingletonGetter(TaskManager); | 8 cr.addSingletonGetter(TaskManager); |
9 | 9 |
10 /* | 10 /* |
11 * Default columns (column_id, label_id, width, is_default) | 11 * Default columns (column_id, label_id, width, is_default) |
12 * @const | 12 * @const |
13 */ | 13 */ |
14 var DEFAULT_COLUMNS = [ | 14 var DEFAULT_COLUMNS = [ |
15 ['title', 'PAGE_COLUMN', 300, true], | 15 ['title', 'pageColumn', 300, true], |
16 ['profileName', 'PROFILE_NAME_COLUMN', 120, false], | 16 ['profileName', 'profileNameColumn', 120, false], |
17 ['physicalMemory', 'PHYSICAL_MEM_COLUMN', 80, true], | 17 ['physicalMemory', 'physicalMemColumn', 80, true], |
18 ['sharedMemory', 'SHARED_MEM_COLUMN', 80, false], | 18 ['sharedMemory', 'sharedMemColumn', 80, false], |
19 ['privateMemory', 'PRIVATE_MEM_COLUMN', 80, false], | 19 ['privateMemory', 'privateMemColumn', 80, false], |
20 ['cpuUsage', 'CPU_COLUMN', 80, true], | 20 ['cpuUsage', 'cpuColumn', 80, true], |
21 ['networkUsage', 'NET_COLUMN', 85, true], | 21 ['networkUsage', 'netColumn', 85, true], |
22 ['processId', 'PROCESS_ID_COLUMN', 100, false], | 22 ['processId', 'processIDColumn', 100, false], |
23 ['webCoreImageCacheSize', 'WEBCORE_IMAGE_CACHE_COLUMN', 120, false], | 23 ['webCoreImageCacheSize', 'webcoreImageCacheColumn', 120, false], |
24 ['webCoreScriptsCacheSize', 'WEBCORE_SCRIPTS_CACHE_COLUMN', 120, false], | 24 ['webCoreScriptsCacheSize', 'webcoreScriptsCacheColumn', 120, false], |
25 ['webCoreCSSCacheSize', 'WEBCORE_CSS_CACHE_COLUMN', 120, false], | 25 ['webCoreCSSCacheSize', 'webcoreCSSCacheColumn', 120, false], |
26 ['fps', 'FPS_COLUMN', 50, true], | 26 ['fps', 'fpsColumn', 50, true], |
27 ['sqliteMemoryUsed', 'SQLITE_MEMORY_USED_COLUMN', 80, false], | 27 ['sqliteMemoryUsed', 'sqliteMemoryUsedColumn', 80, false], |
28 ['goatsTeleported', 'GOATS_TELEPORTED_COLUMN', 80, false], | 28 ['goatsTeleported', 'goatsTeleportedColumn', 80, false], |
29 ['v8MemoryAllocatedSize', 'JAVASCRIPT_MEMORY_ALLOCATED_COLUMN', 120, false], | 29 ['v8MemoryAllocatedSize', 'javascriptMemoryAllocatedColumn', 120, false], |
30 ]; | 30 ]; |
31 | 31 |
32 var COMMAND_CONTEXTMENU_COLUMN_PREFIX = 'columnContextMenu'; | 32 var COMMAND_CONTEXTMENU_COLUMN_PREFIX = 'columnContextMenu'; |
33 var COMMAND_CONTEXTMENU_TABLE_PREFIX = 'tableContextMenu'; | 33 var COMMAND_CONTEXTMENU_TABLE_PREFIX = 'tableContextMenu'; |
34 | 34 |
35 var localStrings = new LocalStrings(); | 35 var localStrings = new LocalStrings(); |
36 | 36 |
37 TaskManager.prototype = { | 37 TaskManager.prototype = { |
38 /** | 38 /** |
39 * Handle window close. | 39 * Handle window close. |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // Creates menuitem element. | 286 // Creates menuitem element. |
287 var item = tm.document_.createElement('menuitem'); | 287 var item = tm.document_.createElement('menuitem'); |
288 item.command = command; | 288 item.command = command; |
289 command.menuitem = item; | 289 command.menuitem = item; |
290 var localized_label = localStrings.getString(string_id); | 290 var localized_label = localStrings.getString(string_id); |
291 item.textContent = localized_label || default_label; | 291 item.textContent = localized_label || default_label; |
292 tm.tableContextMenu_.appendChild(item); | 292 tm.tableContextMenu_.appendChild(item); |
293 }; | 293 }; |
294 | 294 |
295 addMenuItem(this, 'inspect', 'INSPECT', "Inspect"); | 295 addMenuItem(this, 'inspect', 'inspect', "Inspect"); |
296 addMenuItem(this, 'activate', 'ACTIVATE', "Activate"); | 296 addMenuItem(this, 'activate', 'activate', "Activate"); |
297 | 297 |
298 this.document_.body.appendChild(this.tableContextMenu_); | 298 this.document_.body.appendChild(this.tableContextMenu_); |
299 cr.ui.Menu.decorate(this.tableContextMenu_); | 299 cr.ui.Menu.decorate(this.tableContextMenu_); |
300 }, | 300 }, |
301 | 301 |
302 initTable_: function () { | 302 initTable_: function () { |
303 if (!this.dataModel_ || !this.selectionModel_ || !this.columnModel_) { | 303 if (!this.dataModel_ || !this.selectionModel_ || !this.columnModel_) { |
304 console.log('ERROR: some models are not defined.'); | 304 console.log('ERROR: some models are not defined.'); |
305 return; | 305 return; |
306 } | 306 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 taskmanager.onTaskChange(start, length, tasks); | 556 taskmanager.onTaskChange(start, length, tasks); |
557 } | 557 } |
558 | 558 |
559 function taskRemoved(start, length) { | 559 function taskRemoved(start, length) { |
560 // Sometimes this can get called too early. | 560 // Sometimes this can get called too early. |
561 if (!taskmanager) | 561 if (!taskmanager) |
562 return; | 562 return; |
563 taskmanager.onTaskRemove(start, length); | 563 taskmanager.onTaskRemove(start, length); |
564 } | 564 } |
565 | 565 |
OLD | NEW |