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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/task_manager/panel_resource_provider.h
diff --git a/chrome/browser/task_manager/panel_resource_provider.h b/chrome/browser/task_manager/panel_resource_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..86c72698f86204ce2aff3a70a651d4a33b1cff0c
--- /dev/null
+++ b/chrome/browser/task_manager/panel_resource_provider.h
@@ -0,0 +1,65 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
+#define CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+#include "chrome/browser/task_manager/task_manager.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "ui/gfx/image/image_skia.h"
+
+class Panel;
+class TaskManager;
+
+namespace task_manager {
+
+class PanelResource;
+
+class PanelResourceProvider : public TaskManager::ResourceProvider,
+ public content::NotificationObserver {
+ public:
+ explicit PanelResourceProvider(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 ~PanelResourceProvider();
+
+ 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*, PanelResource*> PanelResourceMap;
+ PanelResourceMap resources_;
+
+ // A scoped container for notification registries.
+ content::NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(PanelResourceProvider);
+};
+
+} // namespace task_manager
+
+#endif // CHROME_BROWSER_TASK_MANAGER_PANEL_RESOURCE_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698