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

Side by Side Diff: chrome/browser/resources/task_manager/main.js

Issue 8932003: WebUI Task manager: prevent to kill the wrong process or none (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 /** 78 /**
79 * Closes taskmanager dialog. 79 * Closes taskmanager dialog.
80 * After this function is called, onClose() will be called. 80 * After this function is called, onClose() will be called.
81 * @public 81 * @public
82 */ 82 */
83 close: function () { 83 close: function () {
84 window.close(); 84 window.close();
85 }, 85 },
86 86
87 /** 87 /**
88 * Sends commands to kill a process. 88 * Sends commands to kill selected processes.
89 * @public 89 * @public
90 */ 90 */
91 killProcess: function () { 91 killSelectedProcesses: function () {
92 var selectedIndexes = this.selectionModel_.selectedIndexes; 92 var selectedIndexes = this.selectionModel_.selectedIndexes;
93 chrome.send('killProcess', selectedIndexes); 93 var dm = this.dataModel_;
94 var uniqueIds = [];
95 for (var i = 0; i < selectedIndexes.length; i++) {
96 var index = selectedIndexes[i];
97 var task = dm.item(index);
98 uniqueIds.push(task['uniqueId'][0]);
99 }
100
101 chrome.send('killProcesses', uniqueIds);
94 }, 102 },
95 103
96 /** 104 /**
97 * Sends command to initiate resource inspection. 105 * Sends command to initiate resource inspection.
98 * @public 106 * @public
99 */ 107 */
100 inspect: function (uniqueId) { 108 inspect: function (uniqueId) {
101 chrome.send('inspect', [uniqueId]); 109 chrome.send('inspect', [uniqueId]);
102 }, 110 },
103 111
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 153
146 this.opt_ = opt; 154 this.opt_ = opt;
147 155
148 this.initialized_ = true; 156 this.initialized_ = true;
149 this.enableTaskManager(); 157 this.enableTaskManager();
150 158
151 this.dialogDom_ = dialogDom; 159 this.dialogDom_ = dialogDom;
152 this.document_ = dialogDom.ownerDocument; 160 this.document_ = dialogDom.ownerDocument;
153 161
154 $('close-window').addEventListener('click', this.close.bind(this)); 162 $('close-window').addEventListener('click', this.close.bind(this));
155 $('kill-process').addEventListener('click', this.killProcess.bind(this)); 163 $('kill-process').addEventListener('click',
164 this.killSelectedProcesses.bind(this));
156 $('about-memory-link').addEventListener('click', 165 $('about-memory-link').addEventListener('click',
157 this.openAboutMemory.bind(this)); 166 this.openAboutMemory.bind(this));
158 167
159 this.is_column_shown_ = []; 168 this.is_column_shown_ = [];
160 for (var i = 0; i < DEFAULT_COLUMNS.length; i++) { 169 for (var i = 0; i < DEFAULT_COLUMNS.length; i++) {
161 this.is_column_shown_[i] = DEFAULT_COLUMNS[i][3]; 170 this.is_column_shown_[i] = DEFAULT_COLUMNS[i][3];
162 } 171 }
163 172
164 this.localized_column_ = []; 173 this.localized_column_ = [];
165 for (var i = 0; i < DEFAULT_COLUMNS.length; i++) { 174 for (var i = 0; i < DEFAULT_COLUMNS.length; i++) {
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 taskmanager.onTaskChange(start, length, tasks); 578 taskmanager.onTaskChange(start, length, tasks);
570 } 579 }
571 580
572 function taskRemoved(start, length) { 581 function taskRemoved(start, length) {
573 // Sometimes this can get called too early. 582 // Sometimes this can get called too early.
574 if (!taskmanager) 583 if (!taskmanager)
575 return; 584 return;
576 taskmanager.onTaskRemove(start, length); 585 taskmanager.onTaskRemove(start, length);
577 } 586 }
578 587
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/task_manager/task_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698