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

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

Issue 200094: Some scaffolding for the task manager. (Closed)
Patch Set: DAMN YOU GIT 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/cocoa/task_manager_mac.h"
6
7 #include <algorithm>
8 #include <vector>
9
10 #include "base/mac_util.h"
11
12 ////////////////////////////////////////////////////////////////////////////////
13 // TaskManagerWindowController implementation:
14
15 @implementation TaskManagerWindowController
16
17 - (id)init {
18 NSString* nibpath = [mac_util::MainAppBundle()
19 pathForResource:@"TaskManager"
20 ofType:@"nib"];
21 if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
22 [[self window] makeKeyAndOrderFront:self];
23 }
24 return self;
25 }
26
27 @end
28
29 ////////////////////////////////////////////////////////////////////////////////
30 // TaskManagerMac implementation:
31
32 TaskManagerMac::TaskManagerMac()
33 : task_manager_(TaskManager::GetInstance()),
34 model_(TaskManager::GetInstance()->model()) {
35 window_controller_.reset([[TaskManagerWindowController alloc] init]);
36 }
37
38 // static
39 TaskManagerMac* TaskManagerMac::instance_ = NULL;
40
41 TaskManagerMac::~TaskManagerMac() {
42 task_manager_->OnWindowClosed();
43 model_->RemoveObserver(this);
44 }
45
46 ////////////////////////////////////////////////////////////////////////////////
47 // TaskManagerMac, TaskManagerModelObserver implementation:
48
49 void TaskManagerMac::OnModelChanged() {
50 }
51
52 void TaskManagerMac::OnItemsChanged(int start, int length) {
53 }
54
55 void TaskManagerMac::OnItemsAdded(int start, int length) {
56 }
57
58 void TaskManagerMac::OnItemsRemoved(int start, int length) {
59 }
60
61 ////////////////////////////////////////////////////////////////////////////////
62 // TaskManagerMac, public:
63
64 // static
65 void TaskManagerMac::Show() {
66 if (instance_) {
67 // If there's a Task manager window open already, just activate it.
68 [[instance_->window_controller_ window]
69 makeKeyAndOrderFront:instance_->window_controller_];
70 } else {
71 instance_ = new TaskManagerMac;
72 instance_->model_->StartUpdating();
73 }
74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698