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

Side by Side Diff: chrome/browser/cocoa/task_manager_mac.mm

Issue 521005: Mac: Double-clicking tabs in the task manager should focus that tab. (Closed)
Patch Set: Created 11 years 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 (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/cocoa/task_manager_mac.h" 5 #include "chrome/browser/cocoa/task_manager_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util_mac.h" 10 #include "app/l10n_util_mac.h"
11 #include "base/mac_util.h" 11 #include "base/mac_util.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 14
15 // TODO(thakis): Autoremember window size/pos (and selected columns?) 15 // TODO(thakis): Autoremember window size/pos (and selected columns?)
16 // TODO(thakis): Column sort comparator 16 // TODO(thakis): Column sort comparator
17 // TODO(thakis): Double-clicking a tab should activate that tab
18 // TODO(thakis): Clicking column header doesn't sort 17 // TODO(thakis): Clicking column header doesn't sort
19 // TODO(thakis): Double-clicking a row seems to do something on win/linux
20 // TODO(thakis): On window close, stop updating 18 // TODO(thakis): On window close, stop updating
21 // TODO(thakis): Favicons in rows 19 // TODO(thakis): Favicons in rows
22 // TODO(thakis): Default sort column 20 // TODO(thakis): Default sort column
23 // TODO(thakis): Metrics are all wrong (some fixed when about:memory lands?) 21 // TODO(thakis): Metrics for all processes except browser process are missing.
24 22
25 @interface TaskManagerWindowController (Private) 23 @interface TaskManagerWindowController (Private)
26 - (void)addColumnWithId:(int)columnId visible:(BOOL)isVisible; 24 - (void)addColumnWithId:(int)columnId visible:(BOOL)isVisible;
27 - (void)setUpTableColumns; 25 - (void)setUpTableColumns;
28 - (void)setUpTableHeaderContextMenu; 26 - (void)setUpTableHeaderContextMenu;
29 - (void)toggleColumn:(id)sender; 27 - (void)toggleColumn:(id)sender;
30 - (void)adjustEndProcessButton; 28 - (void)adjustEndProcessButton;
31 @end 29 @end
32 30
33 //////////////////////////////////////////////////////////////////////////////// 31 ////////////////////////////////////////////////////////////////////////////////
(...skipping 24 matching lines...) Expand all
58 56
59 - (IBAction)killSelectedProcesses:(id)sender { 57 - (IBAction)killSelectedProcesses:(id)sender {
60 NSIndexSet* selection = [tableView_ selectedRowIndexes]; 58 NSIndexSet* selection = [tableView_ selectedRowIndexes];
61 for (NSUInteger i = [selection lastIndex]; 59 for (NSUInteger i = [selection lastIndex];
62 i != NSNotFound; 60 i != NSNotFound;
63 i = [selection indexLessThanIndex:i]) { 61 i = [selection indexLessThanIndex:i]) {
64 taskManager_->KillProcess(i); 62 taskManager_->KillProcess(i);
65 } 63 }
66 } 64 }
67 65
66 - (void)selectDoubleClickedTab:(id)sender {
67 NSInteger row = [tableView_ clickedRow];
68 if (row < 0)
69 return; // Happens e.g. if the table header is double-clicked.
70 taskManager_->ActivateProcess(row);
71 }
72
68 - (void)awakeFromNib { 73 - (void)awakeFromNib {
69 [self setUpTableColumns]; 74 [self setUpTableColumns];
70 [self setUpTableHeaderContextMenu]; 75 [self setUpTableHeaderContextMenu];
71 [self adjustEndProcessButton]; 76 [self adjustEndProcessButton];
77
78 [tableView_ setDoubleAction:@selector(selectDoubleClickedTab:)];
Jens Alfke 2009/12/23 19:38:48 I would set the tableView_'s target too for safety
Nico 2009/12/23 19:45:14 If i stick to what the documentation says ("For th
72 } 79 }
73 80
74 // Adds a column which has the given string id as title. |isVisible| specifies 81 // Adds a column which has the given string id as title. |isVisible| specifies
75 // if the column is initially visible. 82 // if the column is initially visible.
76 - (void)addColumnWithId:(int)columnId visible:(BOOL)isVisible { 83 - (void)addColumnWithId:(int)columnId visible:(BOOL)isVisible {
77 scoped_nsobject<NSTableColumn> column([[NSTableColumn alloc] 84 scoped_nsobject<NSTableColumn> column([[NSTableColumn alloc]
78 initWithIdentifier:[NSNumber numberWithInt:columnId]]); 85 initWithIdentifier:[NSNumber numberWithInt:columnId]]);
79 86
80 NSTextAlignment textAlignment = columnId == IDS_TASK_MANAGER_PAGE_COLUMN ? 87 NSTextAlignment textAlignment = columnId == IDS_TASK_MANAGER_PAGE_COLUMN ?
81 NSLeftTextAlignment : NSRightTextAlignment; 88 NSLeftTextAlignment : NSRightTextAlignment;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void TaskManagerMac::Show() { 298 void TaskManagerMac::Show() {
292 if (instance_) { 299 if (instance_) {
293 // If there's a Task manager window open already, just activate it. 300 // If there's a Task manager window open already, just activate it.
294 [[instance_->window_controller_ window] 301 [[instance_->window_controller_ window]
295 makeKeyAndOrderFront:instance_->window_controller_]; 302 makeKeyAndOrderFront:instance_->window_controller_];
296 } else { 303 } else {
297 instance_ = new TaskManagerMac; 304 instance_ = new TaskManagerMac;
298 instance_->model_->StartUpdating(); 305 instance_->model_->StartUpdating();
299 } 306 }
300 } 307 }
OLDNEW
« chrome/browser/cocoa/task_manager_mac.h ('K') | « chrome/browser/cocoa/task_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698