OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cocoa/task_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 { IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN, | 57 { IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN, |
58 arraysize("2000.0K") * kCharWidth, -1 }, | 58 arraysize("2000.0K") * kCharWidth, -1 }, |
59 { IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN, | 59 { IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN, |
60 arraysize("800 kB") * kCharWidth, -1 }, | 60 arraysize("800 kB") * kCharWidth, -1 }, |
61 { IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN, | 61 { IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN, |
62 arraysize("2000.0K (2000.0 live)") * kCharWidth, -1 }, | 62 arraysize("2000.0K (2000.0 live)") * kCharWidth, -1 }, |
63 { IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN, | 63 { IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN, |
64 arraysize("32767") * kCharWidth, -1 }, | 64 arraysize("32767") * kCharWidth, -1 }, |
65 { IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN, | 65 { IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN, |
66 arraysize("idlewakeups") * kCharWidth, -1 }, | 66 arraysize("idlewakeups") * kCharWidth, -1 }, |
67 { IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN, | |
68 arraysize("15 ") * kCharWidth, -1 }, | |
69 }; | 67 }; |
70 | 68 |
71 class SortHelper { | 69 class SortHelper { |
72 public: | 70 public: |
73 SortHelper(TaskManagerModel* model, NSSortDescriptor* column) | 71 SortHelper(TaskManagerModel* model, NSSortDescriptor* column) |
74 : sort_column_([[column key] intValue]), | 72 : sort_column_([[column key] intValue]), |
75 ascending_([column ascending]), | 73 ascending_([column ascending]), |
76 model_(model) {} | 74 model_(model) {} |
77 | 75 |
78 bool operator()(int a, int b) { | 76 bool operator()(int a, int b) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 visible:NO]; | 300 visible:NO]; |
303 [self addColumnWithId:IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN visible:NO]; | 301 [self addColumnWithId:IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN visible:NO]; |
304 [self addColumnWithId:IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN visible:NO]; | 302 [self addColumnWithId:IDS_TASK_MANAGER_VIDEO_MEMORY_COLUMN visible:NO]; |
305 [self addColumnWithId:IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN visible:NO]; | 303 [self addColumnWithId:IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN visible:NO]; |
306 [self addColumnWithId:IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN | 304 [self addColumnWithId:IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN |
307 visible:NO]; | 305 visible:NO]; |
308 [self addColumnWithId:IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN | 306 [self addColumnWithId:IDS_TASK_MANAGER_NACL_DEBUG_STUB_PORT_COLUMN |
309 visible:NO]; | 307 visible:NO]; |
310 [self addColumnWithId:IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN | 308 [self addColumnWithId:IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN |
311 visible:NO]; | 309 visible:NO]; |
312 [self addColumnWithId:IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN visible:NO]; | |
313 } | 310 } |
314 | 311 |
315 // Creates a context menu for the table header that allows the user to toggle | 312 // Creates a context menu for the table header that allows the user to toggle |
316 // which columns should be shown and which should be hidden (like e.g. | 313 // which columns should be shown and which should be hidden (like e.g. |
317 // Task Manager.app's table header context menu). | 314 // Task Manager.app's table header context menu). |
318 - (void)setUpTableHeaderContextMenu { | 315 - (void)setUpTableHeaderContextMenu { |
319 base::scoped_nsobject<NSMenu> contextMenu( | 316 base::scoped_nsobject<NSMenu> contextMenu( |
320 [[NSMenu alloc] initWithTitle:@"Task Manager context menu"]); | 317 [[NSMenu alloc] initWithTitle:@"Task Manager context menu"]); |
321 for (NSTableColumn* column in [tableView_ tableColumns]) { | 318 for (NSTableColumn* column in [tableView_ tableColumns]) { |
322 NSMenuItem* item = [contextMenu.get() | 319 NSMenuItem* item = [contextMenu.get() |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 541 |
545 namespace chrome { | 542 namespace chrome { |
546 | 543 |
547 // Declared in browser_dialogs.h. | 544 // Declared in browser_dialogs.h. |
548 void ShowTaskManager(Browser* browser) { | 545 void ShowTaskManager(Browser* browser) { |
549 TaskManagerMac::Show(); | 546 TaskManagerMac::Show(); |
550 } | 547 } |
551 | 548 |
552 } // namespace chrome | 549 } // namespace chrome |
553 | 550 |
OLD | NEW |