OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 i = [viewSelection indexLessThanIndex:i]) { | 154 i = [viewSelection indexLessThanIndex:i]) { |
155 modelSelection.push_back(viewToModelMap_[i]); | 155 modelSelection.push_back(viewToModelMap_[i]); |
156 } | 156 } |
157 | 157 |
158 // Sort. | 158 // Sort. |
159 [self sortShuffleArray]; | 159 [self sortShuffleArray]; |
160 | 160 |
161 // Use the model indices to get the new view indices of the selection, and | 161 // Use the model indices to get the new view indices of the selection, and |
162 // set selection to that. This assumes that no rows were added or removed | 162 // set selection to that. This assumes that no rows were added or removed |
163 // (in that case, the selection is cleared before -reloadData is called). | 163 // (in that case, the selection is cleared before -reloadData is called). |
164 if (modelSelection.size() > 0) | 164 if (!modelSelection.empty()) |
165 DCHECK_EQ([tableView_ numberOfRows], model_->ResourceCount()); | 165 DCHECK_EQ([tableView_ numberOfRows], model_->ResourceCount()); |
166 NSMutableIndexSet* indexSet = [NSMutableIndexSet indexSet]; | 166 NSMutableIndexSet* indexSet = [NSMutableIndexSet indexSet]; |
167 for (size_t i = 0; i < modelSelection.size(); ++i) | 167 for (size_t i = 0; i < modelSelection.size(); ++i) |
168 [indexSet addIndex:modelToViewMap_[modelSelection[i]]]; | 168 [indexSet addIndex:modelToViewMap_[modelSelection[i]]]; |
169 [tableView_ selectRowIndexes:indexSet byExtendingSelection:NO]; | 169 [tableView_ selectRowIndexes:indexSet byExtendingSelection:NO]; |
170 | 170 |
171 [tableView_ reloadData]; | 171 [tableView_ reloadData]; |
172 [self adjustSelectionAndEndProcessButton]; | 172 [self adjustSelectionAndEndProcessButton]; |
173 } | 173 } |
174 | 174 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 // "Task Manager" so close the existing window and fall through to | 626 // "Task Manager" so close the existing window and fall through to |
627 // open a new one. | 627 // open a new one. |
628 [[instance_->window_controller_ window] close]; | 628 [[instance_->window_controller_ window] close]; |
629 } | 629 } |
630 } | 630 } |
631 // Create a new instance. | 631 // Create a new instance. |
632 instance_ = new TaskManagerMac(TaskManager::GetInstance(), | 632 instance_ = new TaskManagerMac(TaskManager::GetInstance(), |
633 highlight_background_resources); | 633 highlight_background_resources); |
634 instance_->model_->StartUpdating(); | 634 instance_->model_->StartUpdating(); |
635 } | 635 } |
OLD | NEW |