| 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 #include "chrome/browser/task_manager/task_manager_resource_providers.h" | 5 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 background_contents->web_contents()->GetRenderProcessHost()-> | 736 background_contents->web_contents()->GetRenderProcessHost()-> |
| 737 GetHandle() : | 737 GetHandle() : |
| 738 base::Process::Current().handle(), | 738 base::Process::Current().handle(), |
| 739 background_contents->web_contents()->GetRenderViewHost()), | 739 background_contents->web_contents()->GetRenderViewHost()), |
| 740 background_contents_(background_contents), | 740 background_contents_(background_contents), |
| 741 application_name_(application_name) { | 741 application_name_(application_name) { |
| 742 // Just use the same icon that other extension resources do. | 742 // Just use the same icon that other extension resources do. |
| 743 // TODO(atwilson): Use the favicon when that's available. | 743 // TODO(atwilson): Use the favicon when that's available. |
| 744 if (!default_icon_) { | 744 if (!default_icon_) { |
| 745 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 745 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 746 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); | 746 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGINS_FAVICON); |
| 747 } | 747 } |
| 748 // Ensure that the string has the appropriate direction markers (see comment | 748 // Ensure that the string has the appropriate direction markers (see comment |
| 749 // in TaskManagerTabContentsResource::GetTitle()). | 749 // in TaskManagerTabContentsResource::GetTitle()). |
| 750 base::i18n::AdjustStringForLocaleDirection(&application_name_); | 750 base::i18n::AdjustStringForLocaleDirection(&application_name_); |
| 751 } | 751 } |
| 752 | 752 |
| 753 TaskManagerBackgroundContentsResource::~TaskManagerBackgroundContentsResource( | 753 TaskManagerBackgroundContentsResource::~TaskManagerBackgroundContentsResource( |
| 754 ) { | 754 ) { |
| 755 } | 755 } |
| 756 | 756 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 : type_(type), | 989 : type_(type), |
| 990 name_(name), | 990 name_(name), |
| 991 handle_(handle), | 991 handle_(handle), |
| 992 unique_process_id_(unique_process_id), | 992 unique_process_id_(unique_process_id), |
| 993 network_usage_support_(false) { | 993 network_usage_support_(false) { |
| 994 // We cache the process id because it's not cheap to calculate, and it won't | 994 // We cache the process id because it's not cheap to calculate, and it won't |
| 995 // be available when we get the plugin disconnected notification. | 995 // be available when we get the plugin disconnected notification. |
| 996 pid_ = base::GetProcId(handle); | 996 pid_ = base::GetProcId(handle); |
| 997 if (!default_icon_) { | 997 if (!default_icon_) { |
| 998 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 998 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 999 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); | 999 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGINS_FAVICON); |
| 1000 // TODO(jabdelmalek): use different icon for web workers. | 1000 // TODO(jabdelmalek): use different icon for web workers. |
| 1001 } | 1001 } |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() { | 1004 TaskManagerChildProcessResource::~TaskManagerChildProcessResource() { |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 // TaskManagerResource methods: | 1007 // TaskManagerResource methods: |
| 1008 string16 TaskManagerChildProcessResource::GetTitle() const { | 1008 string16 TaskManagerChildProcessResource::GetTitle() const { |
| 1009 if (title_.empty()) | 1009 if (title_.empty()) |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 // TaskManagerExtensionProcessResource class | 1302 // TaskManagerExtensionProcessResource class |
| 1303 //////////////////////////////////////////////////////////////////////////////// | 1303 //////////////////////////////////////////////////////////////////////////////// |
| 1304 | 1304 |
| 1305 gfx::ImageSkia* TaskManagerExtensionProcessResource::default_icon_ = NULL; | 1305 gfx::ImageSkia* TaskManagerExtensionProcessResource::default_icon_ = NULL; |
| 1306 | 1306 |
| 1307 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( | 1307 TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource( |
| 1308 content::RenderViewHost* render_view_host) | 1308 content::RenderViewHost* render_view_host) |
| 1309 : render_view_host_(render_view_host) { | 1309 : render_view_host_(render_view_host) { |
| 1310 if (!default_icon_) { | 1310 if (!default_icon_) { |
| 1311 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1311 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 1312 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGIN); | 1312 default_icon_ = rb.GetImageSkiaNamed(IDR_PLUGINS_FAVICON); |
| 1313 } | 1313 } |
| 1314 process_handle_ = render_view_host_->GetProcess()->GetHandle(); | 1314 process_handle_ = render_view_host_->GetProcess()->GetHandle(); |
| 1315 unique_process_id_ = render_view_host->GetProcess()->GetID(); | 1315 unique_process_id_ = render_view_host->GetProcess()->GetID(); |
| 1316 pid_ = base::GetProcId(process_handle_); | 1316 pid_ = base::GetProcId(process_handle_); |
| 1317 string16 extension_name = UTF8ToUTF16(GetExtension()->name()); | 1317 string16 extension_name = UTF8ToUTF16(GetExtension()->name()); |
| 1318 DCHECK(!extension_name.empty()); | 1318 DCHECK(!extension_name.empty()); |
| 1319 | 1319 |
| 1320 Profile* profile = Profile::FromBrowserContext( | 1320 Profile* profile = Profile::FromBrowserContext( |
| 1321 render_view_host->GetProcess()->GetBrowserContext()); | 1321 render_view_host->GetProcess()->GetBrowserContext()); |
| 1322 int message_id = GetMessagePrefixID(GetExtension()->is_app(), true, | 1322 int message_id = GetMessagePrefixID(GetExtension()->is_app(), true, |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 | 1686 |
| 1687 return &resource_; | 1687 return &resource_; |
| 1688 } | 1688 } |
| 1689 | 1689 |
| 1690 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 1690 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 1691 task_manager_->AddResource(&resource_); | 1691 task_manager_->AddResource(&resource_); |
| 1692 } | 1692 } |
| 1693 | 1693 |
| 1694 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 1694 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 1695 } | 1695 } |
| OLD | NEW |