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

Side by Side Diff: chrome/browser/task_manager/tab_contents_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: Rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_ H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_ H_ 6 #define CHROME_BROWSER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/task_manager/task_manager.h" 11 #include "chrome/browser/task_manager/task_manager.h"
12 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
14 14
15 class TaskManager; 15 class TaskManager;
16 class TaskManagerTabContentsResource;
17 16
18 namespace content { 17 namespace content {
19 class WebContents; 18 class WebContents;
20 class NotificationSource; 19 class NotificationSource;
21 class NotificationDetails; 20 class NotificationDetails;
22 } 21 }
23 22
23 namespace task_manager {
24
25 class TabContentsResource;
26
24 // Provides resources for tab contents, prerendered pages, Instant pages, and 27 // Provides resources for tab contents, prerendered pages, Instant pages, and
25 // background printing pages. 28 // background printing pages.
26 class TaskManagerTabContentsResourceProvider 29 class TabContentsResourceProvider : public TaskManager::ResourceProvider,
27 : public TaskManager::ResourceProvider, 30 public content::NotificationObserver {
28 public content::NotificationObserver {
29 public: 31 public:
30 explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); 32 explicit TabContentsResourceProvider(TaskManager* task_manager);
31 33
32 virtual TaskManager::Resource* GetResource(int origin_pid, 34 virtual TaskManager::Resource* GetResource(int origin_pid,
33 int render_process_host_id, 35 int render_process_host_id,
34 int routing_id) OVERRIDE; 36 int routing_id) OVERRIDE;
35 virtual void StartUpdating() OVERRIDE; 37 virtual void StartUpdating() OVERRIDE;
36 virtual void StopUpdating() OVERRIDE; 38 virtual void StopUpdating() OVERRIDE;
37 39
38 // content::NotificationObserver method: 40 // content::NotificationObserver method:
39 virtual void Observe(int type, 41 virtual void Observe(int type,
40 const content::NotificationSource& source, 42 const content::NotificationSource& source,
41 const content::NotificationDetails& details) OVERRIDE; 43 const content::NotificationDetails& details) OVERRIDE;
42 44
43 private: 45 private:
44 virtual ~TaskManagerTabContentsResourceProvider(); 46 virtual ~TabContentsResourceProvider();
45 47
46 void Add(content::WebContents* web_contents); 48 void Add(content::WebContents* web_contents);
47 void Remove(content::WebContents* web_contents); 49 void Remove(content::WebContents* web_contents);
48 void InstantCommitted(content::WebContents* web_contents); 50 void InstantCommitted(content::WebContents* web_contents);
49 51
50 void AddToTaskManager(content::WebContents* web_contents); 52 void AddToTaskManager(content::WebContents* web_contents);
51 53
52 // Whether we are currently reporting to the task manager. Used to ignore 54 // Whether we are currently reporting to the task manager. Used to ignore
53 // notifications sent after StopUpdating(). 55 // notifications sent after StopUpdating().
54 bool updating_; 56 bool updating_;
55 57
56 TaskManager* task_manager_; 58 TaskManager* task_manager_;
57 59
58 // Maps the actual resources (the WebContentses) to the Task Manager 60 // Maps the actual resources (the WebContentses) to the Task Manager
59 // resources. 61 // resources.
60 std::map<content::WebContents*, TaskManagerTabContentsResource*> resources_; 62 std::map<content::WebContents*, TabContentsResource*> resources_;
61 63
62 // A scoped container for notification registries. 64 // A scoped container for notification registries.
63 content::NotificationRegistrar registrar_; 65 content::NotificationRegistrar registrar_;
64 66
65 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); 67 DISALLOW_COPY_AND_ASSIGN(TabContentsResourceProvider);
66 }; 68 };
67 69
68 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVID ER_H_ 70 } // namespace task_manager
71
72 #endif // CHROME_BROWSER_TASK_MANAGER_TAB_CONTENTS_RESOURCE_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/renderer_resource.cc ('k') | chrome/browser/task_manager/tab_contents_resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698