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

Side by Side Diff: chrome/browser/ui/cocoa/task_manager_mac.mm

Issue 2225993002: Mac Task Manager: Don't deselect rows before reloading data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 selectedItem -= removedRows; 143 selectedItem -= removedRows;
144 else 144 else
145 selectedItem = -1; // The item was removed. 145 selectedItem = -1; // The item was removed.
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 // Sort. 150 // Sort.
151 [self sortShuffleArray]; 151 [self sortShuffleArray];
152 152
153 // Clear the selection and reload the NSTableView. Note that it is important 153 // Reload the data.
154 // to clear the selection before reloading the data, and to reload the
155 // selection after reloading the data, because otherwise the table will adjust
156 // the selection in ways that are not desirable.
157 [tableView_ deselectAll:nil];
158 [tableView_ reloadData]; 154 [tableView_ reloadData];
159 155
160 // Reload the selection. 156 // Reload the selection.
161 NSMutableIndexSet* indexSet = [NSMutableIndexSet indexSet]; 157 NSMutableIndexSet* indexSet = [NSMutableIndexSet indexSet];
162 for (auto selectedItem : modelSelection) { 158 for (auto selectedItem : modelSelection) {
163 if (selectedItem != -1) 159 if (selectedItem != -1)
164 [indexSet addIndex:modelToViewMap_[selectedItem]]; 160 [indexSet addIndex:modelToViewMap_[selectedItem]];
165 } 161 }
166 [tableView_ selectRowIndexes:indexSet byExtendingSelection:NO]; 162 [tableView_ selectRowIndexes:indexSet byExtendingSelection:NO];
167 163
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 void HideTaskManager() { 648 void HideTaskManager() {
653 if (chrome::ToolkitViewsDialogsEnabled()) { 649 if (chrome::ToolkitViewsDialogsEnabled()) {
654 chrome::HideTaskManagerViews(); 650 chrome::HideTaskManagerViews();
655 return; 651 return;
656 } 652 }
657 653
658 task_manager::TaskManagerMac::Hide(); 654 task_manager::TaskManagerMac::Hide();
659 } 655 }
660 656
661 } // namespace chrome 657 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698