| Index: chrome/browser/task_manager/background_resource_provider.cc
|
| diff --git a/chrome/browser/task_manager/task_manager_background_resource_provider.cc b/chrome/browser/task_manager/background_resource_provider.cc
|
| similarity index 84%
|
| rename from chrome/browser/task_manager/task_manager_background_resource_provider.cc
|
| rename to chrome/browser/task_manager/background_resource_provider.cc
|
| index 6c95b90c82ab365f4f6b8bfd29f8b280e325bbdc..635ea7afce56a766feef631b7fdd9c8cee88f5c1 100644
|
| --- a/chrome/browser/task_manager/task_manager_background_resource_provider.cc
|
| +++ b/chrome/browser/task_manager/background_resource_provider.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/task_manager/task_manager_background_resource_provider.h"
|
| +#include "chrome/browser/task_manager/background_resource_provider.h"
|
|
|
| #include "base/i18n/rtl.h"
|
| #include "base/string16.h"
|
| @@ -14,7 +14,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/tab_contents/background_contents.h"
|
| -#include "chrome/browser/task_manager/task_manager_render_resource.h"
|
| +#include "chrome/browser/task_manager/renderer_resource.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/extensions/extension.h"
|
| #include "content/public/browser/notification_service.h"
|
| @@ -32,13 +32,14 @@ using content::RenderViewHost;
|
| using content::WebContents;
|
| using extensions::Extension;
|
|
|
| -class TaskManagerBackgroundContentsResource
|
| - : public TaskManagerRendererResource {
|
| +namespace task_manager {
|
| +
|
| +class BackgroundContentsResource : public RendererResource {
|
| public:
|
| - TaskManagerBackgroundContentsResource(
|
| + BackgroundContentsResource(
|
| BackgroundContents* background_contents,
|
| const string16& application_name);
|
| - virtual ~TaskManagerBackgroundContentsResource();
|
| + virtual ~BackgroundContentsResource();
|
|
|
| // TaskManager::Resource methods:
|
| virtual string16 GetTitle() const OVERRIDE;
|
| @@ -57,18 +58,18 @@ class TaskManagerBackgroundContentsResource
|
| // BackgroundContents.
|
| static gfx::ImageSkia* default_icon_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(TaskManagerBackgroundContentsResource);
|
| + DISALLOW_COPY_AND_ASSIGN(BackgroundContentsResource);
|
| };
|
|
|
| -gfx::ImageSkia* TaskManagerBackgroundContentsResource::default_icon_ = NULL;
|
| +gfx::ImageSkia* BackgroundContentsResource::default_icon_ = NULL;
|
|
|
| // TODO(atwilson): http://crbug.com/116893
|
| // HACK: if the process handle is invalid, we use the current process's handle.
|
| // This preserves old behavior but is incorrect, and should be fixed.
|
| -TaskManagerBackgroundContentsResource::TaskManagerBackgroundContentsResource(
|
| +BackgroundContentsResource::BackgroundContentsResource(
|
| BackgroundContents* background_contents,
|
| const string16& application_name)
|
| - : TaskManagerRendererResource(
|
| + : RendererResource(
|
| background_contents->web_contents()->GetRenderProcessHost()->
|
| GetHandle() ?
|
| background_contents->web_contents()->GetRenderProcessHost()->
|
| @@ -88,11 +89,10 @@ TaskManagerBackgroundContentsResource::TaskManagerBackgroundContentsResource(
|
| base::i18n::AdjustStringForLocaleDirection(&application_name_);
|
| }
|
|
|
| -TaskManagerBackgroundContentsResource::~TaskManagerBackgroundContentsResource(
|
| - ) {
|
| +BackgroundContentsResource::~BackgroundContentsResource() {
|
| }
|
|
|
| -string16 TaskManagerBackgroundContentsResource::GetTitle() const {
|
| +string16 BackgroundContentsResource::GetTitle() const {
|
| string16 title = application_name_;
|
|
|
| if (title.empty()) {
|
| @@ -104,34 +104,32 @@ string16 TaskManagerBackgroundContentsResource::GetTitle() const {
|
| return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_BACKGROUND_PREFIX, title);
|
| }
|
|
|
| -string16 TaskManagerBackgroundContentsResource::GetProfileName() const {
|
| +string16 BackgroundContentsResource::GetProfileName() const {
|
| return string16();
|
| }
|
|
|
| -gfx::ImageSkia TaskManagerBackgroundContentsResource::GetIcon() const {
|
| +gfx::ImageSkia BackgroundContentsResource::GetIcon() const {
|
| return *default_icon_;
|
| }
|
|
|
| -bool TaskManagerBackgroundContentsResource::IsBackground() const {
|
| +bool BackgroundContentsResource::IsBackground() const {
|
| return true;
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// TaskManagerBackgroundContentsResourceProvider class
|
| +// BackgroundContentsResourceProvider class
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|
| -TaskManagerBackgroundContentsResourceProvider::
|
| - TaskManagerBackgroundContentsResourceProvider(TaskManager* task_manager)
|
| +BackgroundContentsResourceProvider::
|
| + BackgroundContentsResourceProvider(TaskManager* task_manager)
|
| : updating_(false),
|
| task_manager_(task_manager) {
|
| }
|
|
|
| -TaskManagerBackgroundContentsResourceProvider::
|
| - ~TaskManagerBackgroundContentsResourceProvider() {
|
| +BackgroundContentsResourceProvider::~BackgroundContentsResourceProvider() {
|
| }
|
|
|
| -TaskManager::Resource*
|
| -TaskManagerBackgroundContentsResourceProvider::GetResource(
|
| +TaskManager::Resource* BackgroundContentsResourceProvider::GetResource(
|
| int origin_pid,
|
| int render_process_host_id,
|
| int routing_id) {
|
| @@ -153,7 +151,7 @@ TaskManagerBackgroundContentsResourceProvider::GetResource(
|
| return NULL;
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::StartUpdating() {
|
| +void BackgroundContentsResourceProvider::StartUpdating() {
|
| DCHECK(!updating_);
|
| updating_ = true;
|
|
|
| @@ -198,7 +196,7 @@ void TaskManagerBackgroundContentsResourceProvider::StartUpdating() {
|
| content::NotificationService::AllBrowserContextsAndSources());
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::StopUpdating() {
|
| +void BackgroundContentsResourceProvider::StopUpdating() {
|
| DCHECK(updating_);
|
| updating_ = false;
|
|
|
| @@ -219,17 +217,17 @@ void TaskManagerBackgroundContentsResourceProvider::StopUpdating() {
|
| resources_.clear();
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::AddToTaskManager(
|
| +void BackgroundContentsResourceProvider::AddToTaskManager(
|
| BackgroundContents* background_contents,
|
| const string16& application_name) {
|
| - TaskManagerBackgroundContentsResource* resource =
|
| - new TaskManagerBackgroundContentsResource(background_contents,
|
| + BackgroundContentsResource* resource =
|
| + new BackgroundContentsResource(background_contents,
|
| application_name);
|
| resources_[background_contents] = resource;
|
| task_manager_->AddResource(resource);
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::Add(
|
| +void BackgroundContentsResourceProvider::Add(
|
| BackgroundContents* contents, const string16& application_name) {
|
| if (!updating_)
|
| return;
|
| @@ -243,15 +241,14 @@ void TaskManagerBackgroundContentsResourceProvider::Add(
|
| AddToTaskManager(contents, application_name);
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::Remove(
|
| - BackgroundContents* contents) {
|
| +void BackgroundContentsResourceProvider::Remove(BackgroundContents* contents) {
|
| if (!updating_)
|
| return;
|
| Resources::iterator iter = resources_.find(contents);
|
| DCHECK(iter != resources_.end());
|
|
|
| // Remove the resource from the Task Manager.
|
| - TaskManagerBackgroundContentsResource* resource = iter->second;
|
| + BackgroundContentsResource* resource = iter->second;
|
| task_manager_->RemoveResource(resource);
|
| // And from the provider.
|
| resources_.erase(iter);
|
| @@ -259,7 +256,7 @@ void TaskManagerBackgroundContentsResourceProvider::Remove(
|
| delete resource;
|
| }
|
|
|
| -void TaskManagerBackgroundContentsResourceProvider::Observe(
|
| +void BackgroundContentsResourceProvider::Observe(
|
| int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| @@ -313,3 +310,5 @@ void TaskManagerBackgroundContentsResourceProvider::Observe(
|
| return;
|
| }
|
| }
|
| +
|
| +} // namespace task_manager
|
|
|