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

Side by Side 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: Fix bug. 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/views/new_task_manager_view.h" 5 #include "chrome/browser/ui/views/new_task_manager_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 void NewTaskManagerView::SetColumnVisibility(int column_id, 122 void NewTaskManagerView::SetColumnVisibility(int column_id,
123 bool new_visibility) { 123 bool new_visibility) {
124 tab_table_->SetColumnVisibility(column_id, new_visibility); 124 tab_table_->SetColumnVisibility(column_id, new_visibility);
125 } 125 }
126 126
127 bool NewTaskManagerView::IsTableSorted() const { 127 bool NewTaskManagerView::IsTableSorted() const {
128 return tab_table_->is_sorted(); 128 return tab_table_->is_sorted();
129 } 129 }
130 130
131 TableSortDescriptor 131 TableSortDescriptor NewTaskManagerView::GetSortDescriptor() const {
132 NewTaskManagerView::GetSortDescriptor() const {
133 if (!IsTableSorted()) 132 if (!IsTableSorted())
134 return TableSortDescriptor(); 133 return TableSortDescriptor();
135 134
136 const auto& descriptor = tab_table_->sort_descriptors().front(); 135 const auto& descriptor = tab_table_->sort_descriptors().front();
137 return TableSortDescriptor(descriptor.column_id, descriptor.ascending); 136 return TableSortDescriptor(descriptor.column_id, descriptor.ascending);
138 } 137 }
139 138
140 void NewTaskManagerView::ToggleSortOrder(int visible_column_index) { 139 void NewTaskManagerView::SetSortDescriptor(TableSortDescriptor descriptor) {
141 tab_table_->ToggleSortOrder(visible_column_index); 140 views::TableView::SortDescriptors descriptor_list;
141
142 // If |sorted_column_id| is the default value, it means to clear the sort.
143 if (descriptor.sorted_column_id != TableSortDescriptor().sorted_column_id) {
144 descriptor_list.emplace_back(descriptor.sorted_column_id,
145 descriptor.is_ascending);
146 }
147
148 tab_table_->SetSortDescriptors(std::move(descriptor_list));
142 } 149 }
143 150
144 gfx::Size NewTaskManagerView::GetPreferredSize() const { 151 gfx::Size NewTaskManagerView::GetPreferredSize() const {
145 return gfx::Size(460, 270); 152 return gfx::Size(460, 270);
146 } 153 }
147 154
148 bool NewTaskManagerView::AcceleratorPressed( 155 bool NewTaskManagerView::AcceleratorPressed(
149 const ui::Accelerator& accelerator) { 156 const ui::Accelerator& accelerator) {
150 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); 157 DCHECK_EQ(ui::VKEY_W, accelerator.key_code());
151 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); 158 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (!g_browser_process->local_state()) 361 if (!g_browser_process->local_state())
355 return; 362 return;
356 363
357 const base::DictionaryValue* dictionary = 364 const base::DictionaryValue* dictionary =
358 g_browser_process->local_state()->GetDictionary(GetWindowName()); 365 g_browser_process->local_state()->GetDictionary(GetWindowName());
359 if (dictionary) 366 if (dictionary)
360 dictionary->GetBoolean("always_on_top", &is_always_on_top_); 367 dictionary->GetBoolean("always_on_top", &is_always_on_top_);
361 } 368 }
362 369
363 } // namespace task_management 370 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698