| Index: chrome/browser/task_manager/notification_resource_provider.h
|
| diff --git a/chrome/browser/task_manager/notification_resource_provider.h b/chrome/browser/task_manager/notification_resource_provider.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..120791b7b0d952e2c253f90075ac3e37a65ba6e7
|
| --- /dev/null
|
| +++ b/chrome/browser/task_manager/notification_resource_provider.h
|
| @@ -0,0 +1,61 @@
|
| +// 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_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/task_manager.h"
|
| +#include "content/public/browser/notification_observer.h"
|
| +#include "content/public/browser/notification_registrar.h"
|
| +
|
| +class BalloonHost;
|
| +
|
| +namespace task_manager {
|
| +
|
| +class NotificationResource;
|
| +
|
| +class NotificationResourceProvider : public TaskManager::ResourceProvider,
|
| + public content::NotificationObserver {
|
| + public:
|
| + static NotificationResourceProvider* Create(TaskManager* task_manager);
|
| +
|
| + // TaskManager::ResourceProvider interface
|
| + 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 interface
|
| + 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_;
|
| +
|
| + // Maps the actual resources (BalloonHost*) to the Task Manager resources.
|
| + std::map<BalloonHost*, NotificationResource*> resources_;
|
| +
|
| + // A scoped container for notification registries.
|
| + content::NotificationRegistrar registrar_;
|
| +
|
| + bool updating_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(NotificationResourceProvider);
|
| +};
|
| +
|
| +} // namespace task_manager
|
| +
|
| +#endif // CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_
|
|
|