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

Unified Diff: chrome/browser/resources/task_manager/main.js

Issue 7606029: WebUI TaskManager: Supports background-page mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/task_manager/main.js
diff --git a/chrome/browser/resources/task_manager/main.js b/chrome/browser/resources/task_manager/main.js
index 1c7a35cf1165919c95c46a6141ce45c2596efd86..bf0996e29955b643b96eac4bfe8e1267c49c81d7 100644
--- a/chrome/browser/resources/task_manager/main.js
+++ b/chrome/browser/resources/task_manager/main.js
@@ -94,6 +94,8 @@ TaskManager.prototype = {
return;
}
+ this.background_mode = (location.hash == '#bg');
xiyuan 2011/08/11 17:14:13 nit: background_mode -> backgroundMode
xiyuan 2011/08/11 17:14:13 Could we pass backgroundMode from outside instead
+
this.initialized_ = true;
this.enableTaskManager();
@@ -164,7 +166,7 @@ TaskManager.prototype = {
}
for (var i = 0; i < table_columns.length; i++) {
- table_columns[i].renderFunction = this.renderText_.bind(this);
+ table_columns[i].renderFunction = this.renderColumn_.bind(this);
}
this.columnModel_ = new cr.ui.table.TableColumnModel(table_columns);
@@ -224,9 +226,33 @@ TaskManager.prototype = {
// Expands height of row when a process has some tasks.
this.table_.autoExpands = true;
+
+ // Sets custom row render function.
+ this.table_.setRenderFunction(this.renderRow_.bind(this));
+ },
+
+ renderRow_: function(dataItem, table) {
+ var cm = this.table_.columnModel;
xiyuan 2011/08/11 17:14:13 Should we use table instread of this.table_?
+ var listItem = new cr.ui.ListItem({label: ''});
+
+ listItem.className = 'table-row';
+ if (this.background_mode && dataItem.isBackgroundResource)
+ listItem.className += ' table-background-row';
+
+ for (var i = 0; i < cm.size; i++) {
+ var cell = document.createElement('div');
+ cell.style.width = cm.getWidth(i) + '%';
+ cell.className = 'table-row-cell';
+ cell.appendChild(
+ cm.getRenderFunction(i).call(null, dataItem, cm.getId(i), table));
+
+ listItem.appendChild(cell);
+ }
+
+ return listItem;
},
- renderText_: function(entry, columnId, table) {
+ renderColumn_: function(entry, columnId, table) {
var container = this.document_.createElement('div');
container.id = 'detail-container-' + columnId + '-pid' + entry.processId;
container.className = 'detail-container-' + columnId;

Powered by Google App Engine
This is Rietveld 408576698