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

Unified Diff: chrome/browser/task_manager/task_manager_resource_providers.h

Issue 10790062: [Panels refactor] Track Panels in TaskManager now that they are not under the tab contents umbrella. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback changes Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/task_manager_resource_providers.h
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h
index a926ac25f0fca682f912758cbe3f14d3705875cb..47c5f2ff306f5af6f8bc10218c506f5612f29d79 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.h
+++ b/chrome/browser/task_manager/task_manager_resource_providers.h
@@ -21,6 +21,7 @@
class BackgroundContents;
class BalloonHost;
class TabContents;
+class Panel;
namespace content {
class RenderViewHost;
@@ -113,7 +114,7 @@ class TaskManagerTabContentsResource : public TaskManagerRendererResource {
virtual string16 GetTitle() const OVERRIDE;
virtual string16 GetProfileName() const OVERRIDE;
virtual gfx::ImageSkia GetIcon() const OVERRIDE;
- virtual TabContents* GetTabContents() const OVERRIDE;
+ virtual content::WebContents* GetWebContents() const OVERRIDE;
virtual const extensions::Extension* GetExtension() const OVERRIDE;
private:
@@ -171,6 +172,68 @@ class TaskManagerTabContentsResourceProvider
DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider);
};
+class TaskManagerPanelResource : public TaskManagerRendererResource {
+ public:
+ explicit TaskManagerPanelResource(Panel* panel);
+ virtual ~TaskManagerPanelResource();
+
+ // TaskManager::Resource methods:
+ virtual Type GetType() const OVERRIDE;
+ virtual string16 GetTitle() const OVERRIDE;
+ virtual string16 GetProfileName() const OVERRIDE;
+ virtual gfx::ImageSkia GetIcon() const OVERRIDE;
+ virtual content::WebContents* GetWebContents() const OVERRIDE;
+ virtual const extensions::Extension* GetExtension() const OVERRIDE;
+
+ private:
+ Panel* panel_;
+ // Determines prefix for title reflecting whether extensions are apps
+ // or in incognito mode.
+ int message_prefix_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResource);
+};
+
+class TaskManagerPanelResourceProvider
+ : public TaskManager::ResourceProvider,
+ public content::NotificationObserver {
+ public:
+ explicit TaskManagerPanelResourceProvider(TaskManager* task_manager);
+
+ // TaskManager::ResourceProvider methods:
+ virtual TaskManager::Resource* GetResource(int origin_pid,
+ int render_process_host_id,
+ int routing_id) OVERRIDE;
+ virtual void StartUpdating() OVERRIDE;
+ virtual void StopUpdating() OVERRIDE;
+
+ // content::NotificationObserver method:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ private:
+ virtual ~TaskManagerPanelResourceProvider();
+
+ void Add(Panel* panel);
+ void Remove(Panel* panel);
+
+ // Whether we are currently reporting to the task manager. Used to ignore
+ // notifications sent after StopUpdating().
+ bool updating_;
+
+ TaskManager* task_manager_;
+
+ // Maps the actual resources (the Panels) to the Task Manager resources.
+ typedef std::map<Panel*, TaskManagerPanelResource*> PanelResourceMap;
+ PanelResourceMap resources_;
+
+ // A scoped container for notification registries.
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResourceProvider);
+};
+
class TaskManagerBackgroundContentsResource
: public TaskManagerRendererResource {
public:

Powered by Google App Engine
This is Rietveld 408576698