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

Side by Side Diff: chrome/browser/views/task_manager_view.cc

Issue 196040: Gtk: Allow all columns in task manager to be sortable. (Closed)
Patch Set: Delete dead code Created 11 years, 3 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/gtk/task_manager_gtk.cc ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/task_manager.h" 5 #include "chrome/browser/task_manager.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/table_model_observer.h" 8 #include "app/table_model_observer.h"
9 #include "base/stats_table.h" 9 #include "base/stats_table.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 15 matching lines...) Expand all
26 #include "views/controls/table/table_view_observer.h" 26 #include "views/controls/table/table_view_observer.h"
27 #include "views/standard_layout.h" 27 #include "views/standard_layout.h"
28 #include "views/widget/widget.h" 28 #include "views/widget/widget.h"
29 #include "views/window/dialog_delegate.h" 29 #include "views/window/dialog_delegate.h"
30 #include "views/window/window.h" 30 #include "views/window/window.h"
31 31
32 // The task manager window default size. 32 // The task manager window default size.
33 static const int kDefaultWidth = 460; 33 static const int kDefaultWidth = 460;
34 static const int kDefaultHeight = 270; 34 static const int kDefaultHeight = 270;
35 35
36 // An id for the most important column, made sufficiently large so as not to
37 // collide with anything else.
38 static const int64 kNuthMagicNumber = 1737350766;
39 static const int kBitMask = 0x7FFFFFFF;
40 static const int kGoatsTeleportedColumn =
41 (94024 * kNuthMagicNumber) & kBitMask;
42
43 namespace { 36 namespace {
44 37
45 //////////////////////////////////////////////////////////////////////////////// 38 ////////////////////////////////////////////////////////////////////////////////
46 // TaskManagerTableModel class 39 // TaskManagerTableModel class
47 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
48 41
49 class TaskManagerTableModel : public views::GroupTableModel, 42 class TaskManagerTableModel : public views::GroupTableModel,
50 public TaskManagerModelObserver { 43 public TaskManagerModelObserver {
51 public: 44 public:
52 explicit TaskManagerTableModel(TaskManagerModel* model) 45 explicit TaskManagerTableModel(TaskManagerModel* model)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: // Memory 101 case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: // Memory
109 if (!model_->IsResourceFirstInGroup(row)) 102 if (!model_->IsResourceFirstInGroup(row))
110 return std::wstring(); 103 return std::wstring();
111 return model_->GetResourcePhysicalMemory(row); 104 return model_->GetResourcePhysicalMemory(row);
112 105
113 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: 106 case IDS_TASK_MANAGER_PROCESS_ID_COLUMN:
114 if (!model_->IsResourceFirstInGroup(row)) 107 if (!model_->IsResourceFirstInGroup(row))
115 return std::wstring(); 108 return std::wstring();
116 return model_->GetResourceProcessId(row); 109 return model_->GetResourceProcessId(row);
117 110
118 case kGoatsTeleportedColumn: // Goats Teleported! 111 case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: // Goats Teleported!
119 return model_->GetResourceGoatsTeleported(row); 112 return model_->GetResourceGoatsTeleported(row);
120 113
121 default: 114 default:
122 return model_->GetResourceStatsValue(row, col_id); 115 return model_->GetResourceStatsValue(row, col_id);
123 } 116 }
124 } 117 }
125 118
126 SkBitmap TaskManagerTableModel::GetIcon(int row) { 119 SkBitmap TaskManagerTableModel::GetIcon(int row) {
127 return model_->GetResourceIcon(row); 120 return model_->GetResourceIcon(row);
128 } 121 }
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 columns_.back().sortable = true; 294 columns_.back().sortable = true;
302 295
303 tab_table_ = new views::GroupTableView(table_model_.get(), columns_, 296 tab_table_ = new views::GroupTableView(table_model_.get(), columns_,
304 views::ICON_AND_TEXT, false, true, 297 views::ICON_AND_TEXT, false, true,
305 true); 298 true);
306 299
307 // Hide some columns by default 300 // Hide some columns by default
308 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PROCESS_ID_COLUMN, false); 301 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PROCESS_ID_COLUMN, false);
309 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_SHARED_MEM_COLUMN, false); 302 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_SHARED_MEM_COLUMN, false);
310 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN, false); 303 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN, false);
304 tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN,
305 false);
311 306
312 UpdateStatsCounters(); 307 UpdateStatsCounters();
313 TableColumn col(kGoatsTeleportedColumn, L"Goats Teleported",
314 TableColumn::RIGHT, -1, 0);
315 col.sortable = true;
316 columns_.push_back(col);
317 tab_table_->AddColumn(col);
318 tab_table_->SetObserver(this); 308 tab_table_->SetObserver(this);
319 SetContextMenuController(this); 309 SetContextMenuController(this);
320 kill_button_ = new views::NativeButton( 310 kill_button_ = new views::NativeButton(
321 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL)); 311 this, l10n_util::GetString(IDS_TASK_MANAGER_KILL));
322 kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); 312 kill_button_->AddAccelerator(views::Accelerator('E', false, false, false));
323 kill_button_->SetAccessibleKeyboardShortcut(L"E"); 313 kill_button_->SetAccessibleKeyboardShortcut(L"E");
324 about_memory_link_ = new views::Link( 314 about_memory_link_ = new views::Link(
325 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)); 315 l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK));
326 about_memory_link_->SetController(this); 316 about_memory_link_->SetController(this);
327 317
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 615
626 namespace browser { 616 namespace browser {
627 617
628 // Declared in browser_dialogs.h so others don't need to depend on our header. 618 // Declared in browser_dialogs.h so others don't need to depend on our header.
629 void ShowTaskManager() { 619 void ShowTaskManager() {
630 TaskManagerView::Show(); 620 TaskManagerView::Show();
631 } 621 }
632 622
633 } // namespace browser 623 } // namespace browser
634 624
OLDNEW
« no previous file with comments | « chrome/browser/gtk/task_manager_gtk.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698