| 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 /* |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 312 } |
| 313 | 313 |
| 314 this.table_ = this.dialogDom_.querySelector('.detail-table'); | 314 this.table_ = this.dialogDom_.querySelector('.detail-table'); |
| 315 cr.ui.Table.decorate(this.table_); | 315 cr.ui.Table.decorate(this.table_); |
| 316 | 316 |
| 317 this.table_.dataModel = this.dataModel_; | 317 this.table_.dataModel = this.dataModel_; |
| 318 this.table_.selectionModel = this.selectionModel_; | 318 this.table_.selectionModel = this.selectionModel_; |
| 319 this.table_.columnModel = this.columnModel_; | 319 this.table_.columnModel = this.columnModel_; |
| 320 | 320 |
| 321 // Expands height of row when a process has some tasks. | 321 // Expands height of row when a process has some tasks. |
| 322 this.table_.autoExpands = true; | 322 this.table_.fixedHeight = false; |
| 323 | 323 |
| 324 this.table_.list.addEventListener('contextmenu', | 324 this.table_.list.addEventListener('contextmenu', |
| 325 this.onTableContextMenuOpened_.bind(this), | 325 this.onTableContextMenuOpened_.bind(this), |
| 326 true); | 326 true); |
| 327 | 327 |
| 328 // Sets custom row render function. | 328 // Sets custom row render function. |
| 329 this.table_.setRenderFunction(this.renderRow_.bind(this)); | 329 this.table_.setRenderFunction(this.renderRow_.bind(this)); |
| 330 }, | 330 }, |
| 331 | 331 |
| 332 renderRow_: function(dataItem, table) { | 332 renderRow_: function(dataItem, table) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 return container; | 389 return container; |
| 390 }, | 390 }, |
| 391 | 391 |
| 392 onTaskChange: function (start, length, tasks) { | 392 onTaskChange: function (start, length, tasks) { |
| 393 var dm = this.dataModel_; | 393 var dm = this.dataModel_; |
| 394 var sm = this.selectionModel_; | 394 var sm = this.selectionModel_; |
| 395 if (!dm || !sm) | 395 if (!dm || !sm) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 this.table_.list.startBatchUpdates(); |
| 398 // Splice takes the to-be-spliced-in array as individual parameters, | 399 // Splice takes the to-be-spliced-in array as individual parameters, |
| 399 // rather than as an array, so we need to perform some acrobatics... | 400 // rather than as an array, so we need to perform some acrobatics... |
| 400 var args = [].slice.call(tasks); | 401 var args = [].slice.call(tasks); |
| 401 args.unshift(start, length); | 402 args.unshift(start, dm.length); |
| 402 | 403 |
| 404 sm.beginChange(); |
| 403 var oldSelectedIndexes = sm.selectedIndexes; | 405 var oldSelectedIndexes = sm.selectedIndexes; |
| 406 |
| 404 dm.splice.apply(dm, args); | 407 dm.splice.apply(dm, args); |
| 408 |
| 405 sm.selectedIndexes = oldSelectedIndexes; | 409 sm.selectedIndexes = oldSelectedIndexes; |
| 410 sm.endChange(); |
| 411 this.table_.list.endBatchUpdates(); |
| 406 }, | 412 }, |
| 407 | 413 |
| 408 onTaskAdd: function (start, length, tasks) { | 414 onTaskAdd: function (start, length, tasks) { |
| 409 var dm = this.dataModel_; | 415 var dm = this.dataModel_; |
| 410 if (!dm) | 416 if (!dm) |
| 411 return; | 417 return; |
| 412 | 418 |
| 413 // Splice takes the to-be-spliced-in array as individual parameters, | 419 // Splice takes the to-be-spliced-in array as individual parameters, |
| 414 // rather than as an array, so we need to perform some acrobatics... | 420 // rather than as an array, so we need to perform some acrobatics... |
| 415 var args = [].slice.call(tasks); | 421 var args = [].slice.call(tasks); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 taskmanager.onTaskChange(start, length, tasks); | 568 taskmanager.onTaskChange(start, length, tasks); |
| 563 } | 569 } |
| 564 | 570 |
| 565 function taskRemoved(start, length) { | 571 function taskRemoved(start, length) { |
| 566 // Sometimes this can get called too early. | 572 // Sometimes this can get called too early. |
| 567 if (!taskmanager) | 573 if (!taskmanager) |
| 568 return; | 574 return; |
| 569 taskmanager.onTaskRemove(start, length); | 575 taskmanager.onTaskRemove(start, length); |
| 570 } | 576 } |
| 571 | 577 |
| OLD | NEW |