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

Unified Diff: chrome/browser/ui/views/new_task_manager_view.cc

Issue 2146033003: TableView: 3-phase ToggleSortOrder (sorted/reversed/unsorted) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky's fixes. Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/views/new_task_manager_view.h ('k') | ui/views/controls/table/table_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/new_task_manager_view.cc
diff --git a/chrome/browser/ui/views/new_task_manager_view.cc b/chrome/browser/ui/views/new_task_manager_view.cc
index 01a5d3c79290632063bf3f8870e46bf7ee71ce6b..d4c3bbac1cc67e10b305b61e894f007cc963cc09 100644
--- a/chrome/browser/ui/views/new_task_manager_view.cc
+++ b/chrome/browser/ui/views/new_task_manager_view.cc
@@ -128,8 +128,7 @@ bool NewTaskManagerView::IsTableSorted() const {
return tab_table_->is_sorted();
}
-TableSortDescriptor
-NewTaskManagerView::GetSortDescriptor() const {
+TableSortDescriptor NewTaskManagerView::GetSortDescriptor() const {
if (!IsTableSorted())
return TableSortDescriptor();
@@ -137,8 +136,17 @@ NewTaskManagerView::GetSortDescriptor() const {
return TableSortDescriptor(descriptor.column_id, descriptor.ascending);
}
-void NewTaskManagerView::ToggleSortOrder(int visible_column_index) {
- tab_table_->ToggleSortOrder(visible_column_index);
+void NewTaskManagerView::SetSortDescriptor(
+ const TableSortDescriptor& descriptor) {
+ views::TableView::SortDescriptors descriptor_list;
+
+ // If |sorted_column_id| is the default value, it means to clear the sort.
+ if (descriptor.sorted_column_id != TableSortDescriptor().sorted_column_id) {
+ descriptor_list.emplace_back(descriptor.sorted_column_id,
+ descriptor.is_ascending);
+ }
+
+ tab_table_->SetSortDescriptors(descriptor_list);
}
gfx::Size NewTaskManagerView::GetPreferredSize() const {
« no previous file with comments | « chrome/browser/ui/views/new_task_manager_view.h ('k') | ui/views/controls/table/table_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698