| 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_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVIDER_
H_ | |
| 6 #define CHROME_BROWSER_TASK_MANAGER_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 class TaskManagerNotificationResource; | |
| 18 | |
| 19 class TaskManagerNotificationResourceProvider | |
| 20 : public TaskManager::ResourceProvider, | |
| 21 public content::NotificationObserver { | |
| 22 public: | |
| 23 static TaskManagerNotificationResourceProvider* Create( | |
| 24 TaskManager* task_manager); | |
| 25 | |
| 26 // TaskManager::ResourceProvider interface | |
| 27 virtual TaskManager::Resource* GetResource(int origin_pid, | |
| 28 int render_process_host_id, | |
| 29 int routing_id) OVERRIDE; | |
| 30 virtual void StartUpdating() OVERRIDE; | |
| 31 virtual void StopUpdating() OVERRIDE; | |
| 32 | |
| 33 // content::NotificationObserver interface | |
| 34 virtual void Observe(int type, | |
| 35 const content::NotificationSource& source, | |
| 36 const content::NotificationDetails& details) OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 explicit TaskManagerNotificationResourceProvider(TaskManager* task_manager); | |
| 40 virtual ~TaskManagerNotificationResourceProvider(); | |
| 41 | |
| 42 void AddToTaskManager(BalloonHost* balloon_host); | |
| 43 void RemoveFromTaskManager(BalloonHost* balloon_host); | |
| 44 | |
| 45 TaskManager* task_manager_; | |
| 46 | |
| 47 // Maps the actual resources (BalloonHost*) to the Task Manager resources. | |
| 48 std::map<BalloonHost*, TaskManagerNotificationResource*> resources_; | |
| 49 | |
| 50 // A scoped container for notification registries. | |
| 51 content::NotificationRegistrar registrar_; | |
| 52 | |
| 53 bool updating_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(TaskManagerNotificationResourceProvider); | |
| 56 }; | |
| 57 | |
| 58 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_NOTIFICATION_RESOURCE_PROVID
ER_H_ | |
| OLD | NEW |