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

Side by Side Diff: chrome/browser/task_manager/task_manager_resource_providers.h

Issue 10790062: [Panels refactor] Track Panels in TaskManager now that they are not under the tab contents umbrella. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback changes Created 8 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_RESOURCE_PROVIDERS_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ 6 #define CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "chrome/browser/task_manager/task_manager.h" 14 #include "chrome/browser/task_manager/task_manager.h"
15 #include "content/public/browser/child_process_data.h" 15 #include "content/public/browser/child_process_data.h"
16 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/common/process_type.h" 18 #include "content/public/common/process_type.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
20 20
21 class BackgroundContents; 21 class BackgroundContents;
22 class BalloonHost; 22 class BalloonHost;
23 class TabContents; 23 class TabContents;
24 class Panel;
24 25
25 namespace content { 26 namespace content {
26 class RenderViewHost; 27 class RenderViewHost;
27 } 28 }
28 29
29 namespace extensions { 30 namespace extensions {
30 class Extension; 31 class Extension;
31 } 32 }
32 33
33 // These file contains the resource providers used in the task manager. 34 // These file contains the resource providers used in the task manager.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 107
107 // Called when the underlying tab_contents has been committed, and is thus no 108 // Called when the underlying tab_contents has been committed, and is thus no
108 // longer an Instant preview. 109 // longer an Instant preview.
109 void InstantCommitted(); 110 void InstantCommitted();
110 111
111 // TaskManager::Resource methods: 112 // TaskManager::Resource methods:
112 virtual Type GetType() const OVERRIDE; 113 virtual Type GetType() const OVERRIDE;
113 virtual string16 GetTitle() const OVERRIDE; 114 virtual string16 GetTitle() const OVERRIDE;
114 virtual string16 GetProfileName() const OVERRIDE; 115 virtual string16 GetProfileName() const OVERRIDE;
115 virtual gfx::ImageSkia GetIcon() const OVERRIDE; 116 virtual gfx::ImageSkia GetIcon() const OVERRIDE;
116 virtual TabContents* GetTabContents() const OVERRIDE; 117 virtual content::WebContents* GetWebContents() const OVERRIDE;
117 virtual const extensions::Extension* GetExtension() const OVERRIDE; 118 virtual const extensions::Extension* GetExtension() const OVERRIDE;
118 119
119 private: 120 private:
120 bool IsPrerendering() const; 121 bool IsPrerendering() const;
121 122
122 // Returns true if contains content rendered by an extension. 123 // Returns true if contains content rendered by an extension.
123 bool HostsExtension() const; 124 bool HostsExtension() const;
124 125
125 static gfx::ImageSkia* prerender_icon_; 126 static gfx::ImageSkia* prerender_icon_;
126 TabContents* tab_contents_; 127 TabContents* tab_contents_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Maps the actual resources (the TabContentses) to the Task Manager 165 // Maps the actual resources (the TabContentses) to the Task Manager
165 // resources. 166 // resources.
166 std::map<TabContents*, TaskManagerTabContentsResource*> resources_; 167 std::map<TabContents*, TaskManagerTabContentsResource*> resources_;
167 168
168 // A scoped container for notification registries. 169 // A scoped container for notification registries.
169 content::NotificationRegistrar registrar_; 170 content::NotificationRegistrar registrar_;
170 171
171 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider); 172 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResourceProvider);
172 }; 173 };
173 174
175 class TaskManagerPanelResource : public TaskManagerRendererResource {
176 public:
177 explicit TaskManagerPanelResource(Panel* panel);
178 virtual ~TaskManagerPanelResource();
179
180 // TaskManager::Resource methods:
181 virtual Type GetType() const OVERRIDE;
182 virtual string16 GetTitle() const OVERRIDE;
183 virtual string16 GetProfileName() const OVERRIDE;
184 virtual gfx::ImageSkia GetIcon() const OVERRIDE;
185 virtual content::WebContents* GetWebContents() const OVERRIDE;
186 virtual const extensions::Extension* GetExtension() const OVERRIDE;
187
188 private:
189 Panel* panel_;
190 // Determines prefix for title reflecting whether extensions are apps
191 // or in incognito mode.
192 int message_prefix_id_;
193
194 DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResource);
195 };
196
197 class TaskManagerPanelResourceProvider
198 : public TaskManager::ResourceProvider,
199 public content::NotificationObserver {
200 public:
201 explicit TaskManagerPanelResourceProvider(TaskManager* task_manager);
202
203 // TaskManager::ResourceProvider methods:
204 virtual TaskManager::Resource* GetResource(int origin_pid,
205 int render_process_host_id,
206 int routing_id) OVERRIDE;
207 virtual void StartUpdating() OVERRIDE;
208 virtual void StopUpdating() OVERRIDE;
209
210 // content::NotificationObserver method:
211 virtual void Observe(int type,
212 const content::NotificationSource& source,
213 const content::NotificationDetails& details) OVERRIDE;
214
215 private:
216 virtual ~TaskManagerPanelResourceProvider();
217
218 void Add(Panel* panel);
219 void Remove(Panel* panel);
220
221 // Whether we are currently reporting to the task manager. Used to ignore
222 // notifications sent after StopUpdating().
223 bool updating_;
224
225 TaskManager* task_manager_;
226
227 // Maps the actual resources (the Panels) to the Task Manager resources.
228 typedef std::map<Panel*, TaskManagerPanelResource*> PanelResourceMap;
229 PanelResourceMap resources_;
230
231 // A scoped container for notification registries.
232 content::NotificationRegistrar registrar_;
233
234 DISALLOW_COPY_AND_ASSIGN(TaskManagerPanelResourceProvider);
235 };
236
174 class TaskManagerBackgroundContentsResource 237 class TaskManagerBackgroundContentsResource
175 : public TaskManagerRendererResource { 238 : public TaskManagerRendererResource {
176 public: 239 public:
177 TaskManagerBackgroundContentsResource( 240 TaskManagerBackgroundContentsResource(
178 BackgroundContents* background_contents, 241 BackgroundContents* background_contents,
179 const string16& application_name); 242 const string16& application_name);
180 virtual ~TaskManagerBackgroundContentsResource(); 243 virtual ~TaskManagerBackgroundContentsResource();
181 244
182 // TaskManager::Resource methods: 245 // TaskManager::Resource methods:
183 virtual string16 GetTitle() const OVERRIDE; 246 virtual string16 GetTitle() const OVERRIDE;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 private: 613 private:
551 virtual ~TaskManagerBrowserProcessResourceProvider(); 614 virtual ~TaskManagerBrowserProcessResourceProvider();
552 615
553 TaskManager* task_manager_; 616 TaskManager* task_manager_;
554 TaskManagerBrowserProcessResource resource_; 617 TaskManagerBrowserProcessResource resource_;
555 618
556 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); 619 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider);
557 }; 620 };
558 621
559 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ 622 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698