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

Side by Side Diff: chrome/browser/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_PANEL_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_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.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 task_manager {
21
22 class PanelResource;
23
24 class PanelResourceProvider : public TaskManager::ResourceProvider,
25 public content::NotificationObserver {
26 public:
27 explicit PanelResourceProvider(TaskManager* task_manager);
28
29 // TaskManager::ResourceProvider methods:
30 virtual TaskManager::Resource* GetResource(int origin_pid,
31 int render_process_host_id,
32 int routing_id) OVERRIDE;
33 virtual void StartUpdating() OVERRIDE;
34 virtual void StopUpdating() OVERRIDE;
35
36 // content::NotificationObserver method:
37 virtual void Observe(int type,
38 const content::NotificationSource& source,
39 const content::NotificationDetails& details) OVERRIDE;
40
41 private:
42 virtual ~PanelResourceProvider();
43
44 void Add(Panel* panel);
45 void Remove(Panel* panel);
46
47 // Whether we are currently reporting to the task manager. Used to ignore
48 // notifications sent after StopUpdating().
49 bool updating_;
50
51 TaskManager* task_manager_;
52
53 // Maps the actual resources (the Panels) to the Task Manager resources.
54 typedef std::map<Panel*, PanelResource*> PanelResourceMap;
55 PanelResourceMap resources_;
56
57 // A scoped container for notification registries.
58 content::NotificationRegistrar registrar_;
59
60 DISALLOW_COPY_AND_ASSIGN(PanelResourceProvider);
61 };
62
63 } // namespace task_manager
64
65 #endif // CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698