| OLD | NEW |
| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 virtual ~TaskManagerTabContentsResource(); | 107 virtual ~TaskManagerTabContentsResource(); |
| 108 | 108 |
| 109 // Called when the underlying tab_contents has been committed, and is thus no | 109 // Called when the underlying tab_contents has been committed, and is thus no |
| 110 // longer an Instant preview. | 110 // longer an Instant preview. |
| 111 void InstantCommitted(); | 111 void InstantCommitted(); |
| 112 | 112 |
| 113 // TaskManager::Resource methods: | 113 // TaskManager::Resource methods: |
| 114 virtual Type GetType() const OVERRIDE; | 114 virtual Type GetType() const OVERRIDE; |
| 115 virtual string16 GetTitle() const OVERRIDE; | 115 virtual string16 GetTitle() const OVERRIDE; |
| 116 virtual string16 GetProfileName() const OVERRIDE; | 116 virtual string16 GetProfileName() const OVERRIDE; |
| 117 virtual SkBitmap GetIcon() const OVERRIDE; | 117 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 118 virtual TabContentsWrapper* GetTabContents() const OVERRIDE; | 118 virtual TabContentsWrapper* GetTabContents() const OVERRIDE; |
| 119 virtual const extensions::Extension* GetExtension() const OVERRIDE; | 119 virtual const extensions::Extension* GetExtension() const OVERRIDE; |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 bool IsPrerendering() const; | 122 bool IsPrerendering() const; |
| 123 | 123 |
| 124 // Returns true if contains content rendered by an extension. | 124 // Returns true if contains content rendered by an extension. |
| 125 bool HostsExtension() const; | 125 bool HostsExtension() const; |
| 126 | 126 |
| 127 static SkBitmap* prerender_icon_; | 127 static gfx::ImageSkia* prerender_icon_; |
| 128 TabContentsWrapper* tab_contents_; | 128 TabContentsWrapper* tab_contents_; |
| 129 bool is_instant_preview_; | 129 bool is_instant_preview_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); | 131 DISALLOW_COPY_AND_ASSIGN(TaskManagerTabContentsResource); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 class TaskManagerTabContentsResourceProvider | 134 class TaskManagerTabContentsResourceProvider |
| 135 : public TaskManager::ResourceProvider, | 135 : public TaskManager::ResourceProvider, |
| 136 public content::NotificationObserver { | 136 public content::NotificationObserver { |
| 137 public: | 137 public: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 : public TaskManagerRendererResource { | 177 : public TaskManagerRendererResource { |
| 178 public: | 178 public: |
| 179 TaskManagerBackgroundContentsResource( | 179 TaskManagerBackgroundContentsResource( |
| 180 BackgroundContents* background_contents, | 180 BackgroundContents* background_contents, |
| 181 const string16& application_name); | 181 const string16& application_name); |
| 182 virtual ~TaskManagerBackgroundContentsResource(); | 182 virtual ~TaskManagerBackgroundContentsResource(); |
| 183 | 183 |
| 184 // TaskManager::Resource methods: | 184 // TaskManager::Resource methods: |
| 185 virtual string16 GetTitle() const OVERRIDE; | 185 virtual string16 GetTitle() const OVERRIDE; |
| 186 virtual string16 GetProfileName() const OVERRIDE; | 186 virtual string16 GetProfileName() const OVERRIDE; |
| 187 virtual SkBitmap GetIcon() const OVERRIDE; | 187 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 188 virtual bool IsBackground() const OVERRIDE; | 188 virtual bool IsBackground() const OVERRIDE; |
| 189 | 189 |
| 190 const string16& application_name() const { return application_name_; } | 190 const string16& application_name() const { return application_name_; } |
| 191 private: | 191 private: |
| 192 BackgroundContents* background_contents_; | 192 BackgroundContents* background_contents_; |
| 193 | 193 |
| 194 string16 application_name_; | 194 string16 application_name_; |
| 195 | 195 |
| 196 // The icon painted for BackgroundContents. | 196 // The icon painted for BackgroundContents. |
| 197 // TODO(atwilson): Use the favicon when there's a way to get the favicon for | 197 // TODO(atwilson): Use the favicon when there's a way to get the favicon for |
| 198 // BackgroundContents. | 198 // BackgroundContents. |
| 199 static SkBitmap* default_icon_; | 199 static gfx::ImageSkia* default_icon_; |
| 200 | 200 |
| 201 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResource); | 201 DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResource); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 class TaskManagerBackgroundContentsResourceProvider | 204 class TaskManagerBackgroundContentsResourceProvider |
| 205 : public TaskManager::ResourceProvider, | 205 : public TaskManager::ResourceProvider, |
| 206 public content::NotificationObserver { | 206 public content::NotificationObserver { |
| 207 public: | 207 public: |
| 208 explicit TaskManagerBackgroundContentsResourceProvider( | 208 explicit TaskManagerBackgroundContentsResourceProvider( |
| 209 TaskManager* task_manager); | 209 TaskManager* task_manager); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 public: | 250 public: |
| 251 TaskManagerChildProcessResource(content::ProcessType type, | 251 TaskManagerChildProcessResource(content::ProcessType type, |
| 252 const string16& name, | 252 const string16& name, |
| 253 base::ProcessHandle handle, | 253 base::ProcessHandle handle, |
| 254 int unique_process_id); | 254 int unique_process_id); |
| 255 virtual ~TaskManagerChildProcessResource(); | 255 virtual ~TaskManagerChildProcessResource(); |
| 256 | 256 |
| 257 // TaskManager::Resource methods: | 257 // TaskManager::Resource methods: |
| 258 virtual string16 GetTitle() const OVERRIDE; | 258 virtual string16 GetTitle() const OVERRIDE; |
| 259 virtual string16 GetProfileName() const OVERRIDE; | 259 virtual string16 GetProfileName() const OVERRIDE; |
| 260 virtual SkBitmap GetIcon() const OVERRIDE; | 260 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 261 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 261 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 262 virtual int GetUniqueChildProcessId() const OVERRIDE; | 262 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 263 virtual Type GetType() const OVERRIDE; | 263 virtual Type GetType() const OVERRIDE; |
| 264 virtual bool SupportNetworkUsage() const OVERRIDE; | 264 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 265 virtual void SetSupportNetworkUsage() OVERRIDE; | 265 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 266 | 266 |
| 267 // Returns the pid of the child process. | 267 // Returns the pid of the child process. |
| 268 int process_id() const { return pid_; } | 268 int process_id() const { return pid_; } |
| 269 | 269 |
| 270 private: | 270 private: |
| 271 // Returns a localized title for the child process. For example, a plugin | 271 // Returns a localized title for the child process. For example, a plugin |
| 272 // process would be "Plug-in: Flash" when name is "Flash". | 272 // process would be "Plug-in: Flash" when name is "Flash". |
| 273 string16 GetLocalizedTitle() const; | 273 string16 GetLocalizedTitle() const; |
| 274 | 274 |
| 275 content::ProcessType type_; | 275 content::ProcessType type_; |
| 276 string16 name_; | 276 string16 name_; |
| 277 base::ProcessHandle handle_; | 277 base::ProcessHandle handle_; |
| 278 int pid_; | 278 int pid_; |
| 279 int unique_process_id_; | 279 int unique_process_id_; |
| 280 mutable string16 title_; | 280 mutable string16 title_; |
| 281 bool network_usage_support_; | 281 bool network_usage_support_; |
| 282 | 282 |
| 283 // The icon painted for the child processs. | 283 // The icon painted for the child processs. |
| 284 // TODO(jcampan): we should have plugin specific icons for well-known | 284 // TODO(jcampan): we should have plugin specific icons for well-known |
| 285 // plugins. | 285 // plugins. |
| 286 static SkBitmap* default_icon_; | 286 static gfx::ImageSkia* default_icon_; |
| 287 | 287 |
| 288 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); | 288 DISALLOW_COPY_AND_ASSIGN(TaskManagerChildProcessResource); |
| 289 }; | 289 }; |
| 290 | 290 |
| 291 class TaskManagerChildProcessResourceProvider | 291 class TaskManagerChildProcessResourceProvider |
| 292 : public TaskManager::ResourceProvider, | 292 : public TaskManager::ResourceProvider, |
| 293 public content::NotificationObserver { | 293 public content::NotificationObserver { |
| 294 public: | 294 public: |
| 295 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); | 295 explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); |
| 296 | 296 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 347 |
| 348 class TaskManagerExtensionProcessResource : public TaskManager::Resource { | 348 class TaskManagerExtensionProcessResource : public TaskManager::Resource { |
| 349 public: | 349 public: |
| 350 explicit TaskManagerExtensionProcessResource( | 350 explicit TaskManagerExtensionProcessResource( |
| 351 content::RenderViewHost* render_view_host); | 351 content::RenderViewHost* render_view_host); |
| 352 virtual ~TaskManagerExtensionProcessResource(); | 352 virtual ~TaskManagerExtensionProcessResource(); |
| 353 | 353 |
| 354 // TaskManager::Resource methods: | 354 // TaskManager::Resource methods: |
| 355 virtual string16 GetTitle() const OVERRIDE; | 355 virtual string16 GetTitle() const OVERRIDE; |
| 356 virtual string16 GetProfileName() const OVERRIDE; | 356 virtual string16 GetProfileName() const OVERRIDE; |
| 357 virtual SkBitmap GetIcon() const OVERRIDE; | 357 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 358 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 358 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 359 virtual int GetUniqueChildProcessId() const OVERRIDE; | 359 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 360 virtual Type GetType() const OVERRIDE; | 360 virtual Type GetType() const OVERRIDE; |
| 361 virtual bool CanInspect() const OVERRIDE; | 361 virtual bool CanInspect() const OVERRIDE; |
| 362 virtual void Inspect() const OVERRIDE; | 362 virtual void Inspect() const OVERRIDE; |
| 363 virtual bool SupportNetworkUsage() const OVERRIDE; | 363 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 364 virtual void SetSupportNetworkUsage() OVERRIDE; | 364 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 365 virtual const extensions::Extension* GetExtension() const OVERRIDE; | 365 virtual const extensions::Extension* GetExtension() const OVERRIDE; |
| 366 | 366 |
| 367 // Returns the pid of the extension process. | 367 // Returns the pid of the extension process. |
| 368 int process_id() const { return pid_; } | 368 int process_id() const { return pid_; } |
| 369 | 369 |
| 370 // Returns true if the associated extension has a background page. | 370 // Returns true if the associated extension has a background page. |
| 371 virtual bool IsBackground() const OVERRIDE; | 371 virtual bool IsBackground() const OVERRIDE; |
| 372 | 372 |
| 373 private: | 373 private: |
| 374 // The icon painted for the extension process. | 374 // The icon painted for the extension process. |
| 375 static SkBitmap* default_icon_; | 375 static gfx::ImageSkia* default_icon_; |
| 376 | 376 |
| 377 content::RenderViewHost* render_view_host_; | 377 content::RenderViewHost* render_view_host_; |
| 378 | 378 |
| 379 // Cached data about the extension. | 379 // Cached data about the extension. |
| 380 base::ProcessHandle process_handle_; | 380 base::ProcessHandle process_handle_; |
| 381 int pid_; | 381 int pid_; |
| 382 int unique_process_id_; | 382 int unique_process_id_; |
| 383 string16 title_; | 383 string16 title_; |
| 384 | 384 |
| 385 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); | 385 DISALLOW_COPY_AND_ASSIGN(TaskManagerExtensionProcessResource); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 class TaskManagerNotificationResource : public TaskManager::Resource { | 432 class TaskManagerNotificationResource : public TaskManager::Resource { |
| 433 public: | 433 public: |
| 434 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); | 434 explicit TaskManagerNotificationResource(BalloonHost* balloon_host); |
| 435 virtual ~TaskManagerNotificationResource(); | 435 virtual ~TaskManagerNotificationResource(); |
| 436 | 436 |
| 437 // TaskManager::Resource interface | 437 // TaskManager::Resource interface |
| 438 virtual string16 GetTitle() const OVERRIDE; | 438 virtual string16 GetTitle() const OVERRIDE; |
| 439 virtual string16 GetProfileName() const OVERRIDE; | 439 virtual string16 GetProfileName() const OVERRIDE; |
| 440 virtual SkBitmap GetIcon() const OVERRIDE; | 440 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 441 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 441 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 442 virtual int GetUniqueChildProcessId() const OVERRIDE; | 442 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 443 virtual Type GetType() const OVERRIDE; | 443 virtual Type GetType() const OVERRIDE; |
| 444 virtual bool CanInspect() const OVERRIDE; | 444 virtual bool CanInspect() const OVERRIDE; |
| 445 virtual void Inspect() const OVERRIDE; | 445 virtual void Inspect() const OVERRIDE; |
| 446 virtual bool SupportNetworkUsage() const OVERRIDE; | 446 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 447 virtual void SetSupportNetworkUsage() OVERRIDE { } | 447 virtual void SetSupportNetworkUsage() OVERRIDE { } |
| 448 | 448 |
| 449 private: | 449 private: |
| 450 // The icon painted for notifications. . | 450 // The icon painted for notifications. . |
| 451 static SkBitmap* default_icon_; | 451 static gfx::ImageSkia* default_icon_; |
| 452 | 452 |
| 453 // Non-owned pointer to the balloon host. | 453 // Non-owned pointer to the balloon host. |
| 454 BalloonHost* balloon_host_; | 454 BalloonHost* balloon_host_; |
| 455 | 455 |
| 456 // Cached data about the balloon host. | 456 // Cached data about the balloon host. |
| 457 base::ProcessHandle process_handle_; | 457 base::ProcessHandle process_handle_; |
| 458 int pid_; | 458 int pid_; |
| 459 int unique_process_id_; | 459 int unique_process_id_; |
| 460 string16 title_; | 460 string16 title_; |
| 461 | 461 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 }; | 502 }; |
| 503 | 503 |
| 504 class TaskManagerBrowserProcessResource : public TaskManager::Resource { | 504 class TaskManagerBrowserProcessResource : public TaskManager::Resource { |
| 505 public: | 505 public: |
| 506 TaskManagerBrowserProcessResource(); | 506 TaskManagerBrowserProcessResource(); |
| 507 virtual ~TaskManagerBrowserProcessResource(); | 507 virtual ~TaskManagerBrowserProcessResource(); |
| 508 | 508 |
| 509 // TaskManager::Resource methods: | 509 // TaskManager::Resource methods: |
| 510 virtual string16 GetTitle() const OVERRIDE; | 510 virtual string16 GetTitle() const OVERRIDE; |
| 511 virtual string16 GetProfileName() const OVERRIDE; | 511 virtual string16 GetProfileName() const OVERRIDE; |
| 512 virtual SkBitmap GetIcon() const OVERRIDE; | 512 virtual gfx::ImageSkia GetIcon() const OVERRIDE; |
| 513 virtual base::ProcessHandle GetProcess() const OVERRIDE; | 513 virtual base::ProcessHandle GetProcess() const OVERRIDE; |
| 514 virtual int GetUniqueChildProcessId() const OVERRIDE; | 514 virtual int GetUniqueChildProcessId() const OVERRIDE; |
| 515 virtual Type GetType() const OVERRIDE; | 515 virtual Type GetType() const OVERRIDE; |
| 516 | 516 |
| 517 virtual bool SupportNetworkUsage() const OVERRIDE; | 517 virtual bool SupportNetworkUsage() const OVERRIDE; |
| 518 virtual void SetSupportNetworkUsage() OVERRIDE; | 518 virtual void SetSupportNetworkUsage() OVERRIDE; |
| 519 | 519 |
| 520 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; | 520 virtual bool ReportsSqliteMemoryUsed() const OVERRIDE; |
| 521 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; | 521 virtual size_t SqliteMemoryUsedBytes() const OVERRIDE; |
| 522 | 522 |
| 523 virtual bool ReportsV8MemoryStats() const OVERRIDE; | 523 virtual bool ReportsV8MemoryStats() const OVERRIDE; |
| 524 virtual size_t GetV8MemoryAllocated() const OVERRIDE; | 524 virtual size_t GetV8MemoryAllocated() const OVERRIDE; |
| 525 virtual size_t GetV8MemoryUsed() const OVERRIDE; | 525 virtual size_t GetV8MemoryUsed() const OVERRIDE; |
| 526 | 526 |
| 527 private: | 527 private: |
| 528 base::ProcessHandle process_; | 528 base::ProcessHandle process_; |
| 529 mutable string16 title_; | 529 mutable string16 title_; |
| 530 | 530 |
| 531 static SkBitmap* default_icon_; | 531 static gfx::ImageSkia* default_icon_; |
| 532 | 532 |
| 533 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); | 533 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResource); |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 class TaskManagerBrowserProcessResourceProvider | 536 class TaskManagerBrowserProcessResourceProvider |
| 537 : public TaskManager::ResourceProvider { | 537 : public TaskManager::ResourceProvider { |
| 538 public: | 538 public: |
| 539 explicit TaskManagerBrowserProcessResourceProvider( | 539 explicit TaskManagerBrowserProcessResourceProvider( |
| 540 TaskManager* task_manager); | 540 TaskManager* task_manager); |
| 541 | 541 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 552 private: | 552 private: |
| 553 virtual ~TaskManagerBrowserProcessResourceProvider(); | 553 virtual ~TaskManagerBrowserProcessResourceProvider(); |
| 554 | 554 |
| 555 TaskManager* task_manager_; | 555 TaskManager* task_manager_; |
| 556 TaskManagerBrowserProcessResource resource_; | 556 TaskManagerBrowserProcessResource resource_; |
| 557 | 557 |
| 558 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); | 558 DISALLOW_COPY_AND_ASSIGN(TaskManagerBrowserProcessResourceProvider); |
| 559 }; | 559 }; |
| 560 | 560 |
| 561 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ | 561 #endif // CHROME_BROWSER_TASK_MANAGER_TASK_MANAGER_RESOURCE_PROVIDERS_H_ |
| OLD | NEW |