#ifndef CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_
#define CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_
#include <map>
#include <vector>
#include "base/basictypes.h"
#include "chrome/browser/task_manager/resource_provider.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
class BalloonHost;
class TaskManager;
namespace task_manager {
class NotificationResource;
class NotificationResourceProvider : public ResourceProvider,
public content::NotificationObserver {
public:
static NotificationResourceProvider* Create(TaskManager* task_manager);
virtual Resource* GetResource(int origin_pid,
int child_id,
int route_id) OVERRIDE;
virtual void StartUpdating() OVERRIDE;
virtual void StopUpdating() OVERRIDE;
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
private:
explicit NotificationResourceProvider(TaskManager* task_manager);
virtual ~NotificationResourceProvider();
void AddToTaskManager(BalloonHost* balloon_host);
void RemoveFromTaskManager(BalloonHost* balloon_host);
TaskManager* task_manager_;
std::map<BalloonHost*, NotificationResource*> resources_;
content::NotificationRegistrar registrar_;
bool updating_;
DISALLOW_COPY_AND_ASSIGN(NotificationResourceProvider);
};
}
#endif