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

Side by Side Diff: chrome/browser/ui/task_manager/task_manager_table_model.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_manager/task_manager_table_model.h" 5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 dictionary->GetBoolean(col_id_key, &col_visibility); 748 dictionary->GetBoolean(col_id_key, &col_visibility);
749 749
750 // If the above GetBoolean() fails, the |col_visibility| remains at the 750 // If the above GetBoolean() fails, the |col_visibility| remains at the
751 // default visibility. 751 // default visibility.
752 columns_settings_->SetBoolean(col_id_key, col_visibility); 752 columns_settings_->SetBoolean(col_id_key, col_visibility);
753 table_view_delegate_->SetColumnVisibility(col_id, col_visibility); 753 table_view_delegate_->SetColumnVisibility(col_id, col_visibility);
754 UpdateRefreshTypes(col_id, col_visibility); 754 UpdateRefreshTypes(col_id, col_visibility);
755 755
756 if (col_visibility) { 756 if (col_visibility) {
757 if (sorted_col_id == col_id_key) { 757 if (sorted_col_id == col_id_key) {
758 if (sort_is_ascending == kColumns[i].initial_sort_is_ascending) { 758 table_view_delegate_->SetSortDescriptor(
759 table_view_delegate_->ToggleSortOrder(current_visible_column_index); 759 TableSortDescriptor(col_id, sort_is_ascending));
760 } else {
761 // Unfortunately the API of ui::TableView doesn't provide a clean way
762 // to sort by a particular column ID and a sort direction. If the
763 // retrieved sort direction is different than the initial one, we have
764 // to toggle the sort order twice!
765 // Note that the function takes the visible_column_index rather than
766 // a column ID.
767 table_view_delegate_->ToggleSortOrder(current_visible_column_index);
768 table_view_delegate_->ToggleSortOrder(current_visible_column_index);
769 }
770 } 760 }
771 761
772 ++current_visible_column_index; 762 ++current_visible_column_index;
773 } 763 }
774 } 764 }
775 } 765 }
776 766
777 void TaskManagerTableModel::StoreColumnsSettings() { 767 void TaskManagerTableModel::StoreColumnsSettings() {
778 PrefService* local_state = g_browser_process->local_state(); 768 PrefService* local_state = g_browser_process->local_state();
779 if (!local_state) 769 if (!local_state)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { 822 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const {
833 if (row_index == 0) 823 if (row_index == 0)
834 return true; 824 return true;
835 825
836 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != 826 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) !=
837 observed_task_manager()->GetProcessId(tasks_[row_index]); 827 observed_task_manager()->GetProcessId(tasks_[row_index]);
838 } 828 }
839 829
840 830
841 } // namespace task_management 831 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/ui/task_manager/task_manager_table_model.h ('k') | chrome/browser/ui/views/new_task_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698