OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "chrome/browser/task_manager/task_manager.h" |
| 13 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" |
| 15 |
| 16 class BalloonHost; |
| 17 |
| 18 namespace task_manager { |
| 19 |
| 20 class NotificationResource; |
| 21 |
| 22 class NotificationResourceProvider : public TaskManager::ResourceProvider, |
| 23 public content::NotificationObserver { |
| 24 public: |
| 25 static NotificationResourceProvider* Create(TaskManager* task_manager); |
| 26 |
| 27 // TaskManager::ResourceProvider interface |
| 28 virtual TaskManager::Resource* GetResource(int origin_pid, |
| 29 int render_process_host_id, |
| 30 int routing_id) OVERRIDE; |
| 31 virtual void StartUpdating() OVERRIDE; |
| 32 virtual void StopUpdating() OVERRIDE; |
| 33 |
| 34 // content::NotificationObserver interface |
| 35 virtual void Observe(int type, |
| 36 const content::NotificationSource& source, |
| 37 const content::NotificationDetails& details) OVERRIDE; |
| 38 |
| 39 private: |
| 40 explicit NotificationResourceProvider(TaskManager* task_manager); |
| 41 virtual ~NotificationResourceProvider(); |
| 42 |
| 43 void AddToTaskManager(BalloonHost* balloon_host); |
| 44 void RemoveFromTaskManager(BalloonHost* balloon_host); |
| 45 |
| 46 TaskManager* task_manager_; |
| 47 |
| 48 // Maps the actual resources (BalloonHost*) to the Task Manager resources. |
| 49 std::map<BalloonHost*, NotificationResource*> resources_; |
| 50 |
| 51 // A scoped container for notification registries. |
| 52 content::NotificationRegistrar registrar_; |
| 53 |
| 54 bool updating_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(NotificationResourceProvider); |
| 57 }; |
| 58 |
| 59 } // namespace task_manager |
| 60 |
| 61 #endif // CHROME_BROWSER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_H_ |
OLD | NEW |