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.
5 #ifndef CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "chrome/browser/task_manager/resource_provider.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"
20 namespace task_manager
{
24 class PanelResourceProvider
: public ResourceProvider
,
25 public content::NotificationObserver
{
27 explicit PanelResourceProvider(TaskManager
* task_manager
);
29 // ResourceProvider methods:
30 virtual Resource
* GetResource(int origin_pid
,
32 int route_id
) OVERRIDE
;
33 virtual void StartUpdating() OVERRIDE
;
34 virtual void StopUpdating() OVERRIDE
;
36 // content::NotificationObserver method:
37 virtual void Observe(int type
,
38 const content::NotificationSource
& source
,
39 const content::NotificationDetails
& details
) OVERRIDE
;
42 virtual ~PanelResourceProvider();
44 void Add(Panel
* panel
);
45 void Remove(Panel
* panel
);
47 // Whether we are currently reporting to the task manager. Used to ignore
48 // notifications sent after StopUpdating().
51 TaskManager
* task_manager_
;
53 // Maps the actual resources (the Panels) to the Task Manager resources.
54 typedef std::map
<Panel
*, PanelResource
*> PanelResourceMap
;
55 PanelResourceMap resources_
;
57 // A scoped container for notification registries.
58 content::NotificationRegistrar registrar_
;
60 DISALLOW_COPY_AND_ASSIGN(PanelResourceProvider
);
63 } // namespace task_manager
65 #endif // CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_