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

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: 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
141 tab_table_->ToggleSortOrder(visible_column_index); 140 const TableSortDescriptor& descriptor) {
141 views::TableView::SortDescriptors descriptor_list;
142
143 // If |sorted_column_id| is the default value, it means to clear the sort.
144 if (descriptor.sorted_column_id != TableSortDescriptor().sorted_column_id) {
145 descriptor_list.emplace_back(descriptor.sorted_column_id,
146 descriptor.is_ascending);
147 }
148
149 tab_table_->SetSortDescriptors(descriptor_list);
142 } 150 }
143 151
144 gfx::Size NewTaskManagerView::GetPreferredSize() const { 152 gfx::Size NewTaskManagerView::GetPreferredSize() const {
145 return gfx::Size(460, 270); 153 return gfx::Size(460, 270);
146 } 154 }
147 155
148 bool NewTaskManagerView::AcceleratorPressed( 156 bool NewTaskManagerView::AcceleratorPressed(
149 const ui::Accelerator& accelerator) { 157 const ui::Accelerator& accelerator) {
150 DCHECK_EQ(ui::VKEY_W, accelerator.key_code()); 158 DCHECK_EQ(ui::VKEY_W, accelerator.key_code());
151 DCHECK_EQ(ui::EF_CONTROL_DOWN, accelerator.modifiers()); 159 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()) 362 if (!g_browser_process->local_state())
355 return; 363 return;
356 364
357 const base::DictionaryValue* dictionary = 365 const base::DictionaryValue* dictionary =
358 g_browser_process->local_state()->GetDictionary(GetWindowName()); 366 g_browser_process->local_state()->GetDictionary(GetWindowName());
359 if (dictionary) 367 if (dictionary)
360 dictionary->GetBoolean("always_on_top", &is_always_on_top_); 368 dictionary->GetBoolean("always_on_top", &is_always_on_top_);
361 } 369 }
362 370
363 } // namespace task_management 371 } // namespace task_management
OLDNEW
« 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