Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / task_manager / panel_resource_provider.h
blob2c7a6691e0393bcc624e63a9d6d648c5a955408d
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_
8 #include <map>
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"
17 class Panel;
18 class TaskManager;
20 namespace task_manager {
22 class PanelResource;
24 class PanelResourceProvider : public ResourceProvider,
25 public content::NotificationObserver {
26 public:
27 explicit PanelResourceProvider(TaskManager* task_manager);
29 // ResourceProvider methods:
30 virtual Resource* GetResource(int origin_pid,
31 int child_id,
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;
41 private:
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().
49 bool updating_;
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_