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

Side by Side Diff: chrome/browser/task_manager/task_manager_panel_resource_provider.h

Issue 15196003: Create task_manager namespace and wrap classes related to TaskManager with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RendererResource Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/string16.h"
12 #include "chrome/browser/task_manager/task_manager_render_resource.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15 #include "ui/gfx/image/image_skia.h"
16
17 class Panel;
18 class TaskManager;
19
20 namespace content {
21 class WebContents;
22 }
23
24 namespace extensions {
25 class Extension;
26 }
27
28 class TaskManagerPanelResource : public TaskManagerRendererResource {
29 public:
30 explicit TaskManagerPanelResource(Panel* panel);
31 virtual ~TaskManagerPanelResource();
32
33 // TaskManager::Resource methods:
34 virtual Type GetType() const OVERRIDE;
35 virtual string16 GetTitle() const OVERRIDE;
36 virtual string16 GetProfileName() const OVERRIDE;
37 virtual gfx::ImageSkia GetIcon() const OVERRIDE;
38 virtual content::WebContents* GetWebContents() const OVERRIDE;
39 virtual const extensions::Extension* GetExtension() const OVERRIDE;
40
41 private:
42 Panel* panel_;
43 // Determines prefix for title reflecting whether extensions are apps
44 // or in incognito mode.
45 int message_prefix_id_;
46
47 DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResource);
48 };
49
50 class TaskManagerPanelResourceProvider
51 : public TaskManager::ResourceProvider,
52 public content::NotificationObserver {
53 public:
54 explicit TaskManagerPanelResourceProvider(TaskManager* task_manager);
55
56 // TaskManager::ResourceProvider methods:
57 virtual TaskManager::Resource* GetResource(int origin_pid,
58 int render_process_host_id,
59 int routing_id) OVERRIDE;
60 virtual void StartUpdating() OVERRIDE;
61 virtual void StopUpdating() OVERRIDE;
62
63 // content::NotificationObserver method:
64 virtual void Observe(int type,
65 const content::NotificationSource& source,
66 const content::NotificationDetails& details) OVERRIDE;
67
68 private:
69 virtual ~TaskManagerPanelResourceProvider();
70
71 void Add(Panel* panel);
72 void Remove(Panel* panel);
73
74 // Whether we are currently reporting to the task manager. Used to ignore
75 // notifications sent after StopUpdating().
76 bool updating_;
77
78 TaskManager* task_manager_;
79
80 // Maps the actual resources (the Panels) to the Task Manager resources.
81 typedef std::map<Panel*, TaskManagerPanelResource*> PanelResourceMap;
82 PanelResourceMap resources_;
83
84 // A scoped container for notification registries.
85 content::NotificationRegistrar registrar_;
86
87 DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResourceProvider);
88 };
89
90 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698