| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_resource_providers.h" | 5 #include "chrome/browser/task_manager_resource_providers.h" |
| 6 | 6 |
| 7 #include "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 28 // TaskManagerWebContentsResource class | 28 // TaskManagerWebContentsResource class |
| 29 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 30 | 30 |
| 31 TaskManagerWebContentsResource::TaskManagerWebContentsResource( | 31 TaskManagerWebContentsResource::TaskManagerWebContentsResource( |
| 32 WebContents* web_contents) | 32 WebContents* web_contents) |
| 33 : web_contents_(web_contents) { | 33 : web_contents_(web_contents) { |
| 34 // We cache the process as when the WebContents is closed the process | 34 // We cache the process as when the WebContents is closed the process |
| 35 // becomes NULL and the TaskManager still needs it. | 35 // becomes NULL and the TaskManager still needs it. |
| 36 process_ = web_contents_->process()->process().handle(); | 36 process_ = web_contents_->process()->process().handle(); |
| 37 pid_ = process_util::GetProcId(process_); | 37 pid_ = base::GetProcId(process_); |
| 38 } | 38 } |
| 39 | 39 |
| 40 TaskManagerWebContentsResource::~TaskManagerWebContentsResource() { | 40 TaskManagerWebContentsResource::~TaskManagerWebContentsResource() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 std::wstring TaskManagerWebContentsResource::GetTitle() const { | 43 std::wstring TaskManagerWebContentsResource::GetTitle() const { |
| 44 // GetTitle() and GetURL() can only be invoked when the WebContents has a | 44 // GetTitle() and GetURL() can only be invoked when the WebContents has a |
| 45 // controller. | 45 // controller. |
| 46 if (!web_contents_->controller()) | 46 if (!web_contents_->controller()) |
| 47 return std::wstring(); | 47 return std::wstring(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 //////////////////////////////////////////////////////////////////////////////// | 229 //////////////////////////////////////////////////////////////////////////////// |
| 230 // TaskManagerPluginProcessResource class | 230 // TaskManagerPluginProcessResource class |
| 231 //////////////////////////////////////////////////////////////////////////////// | 231 //////////////////////////////////////////////////////////////////////////////// |
| 232 SkBitmap* TaskManagerPluginProcessResource::default_icon_ = NULL; | 232 SkBitmap* TaskManagerPluginProcessResource::default_icon_ = NULL; |
| 233 | 233 |
| 234 TaskManagerPluginProcessResource::TaskManagerPluginProcessResource( | 234 TaskManagerPluginProcessResource::TaskManagerPluginProcessResource( |
| 235 PluginProcessInfo plugin_proc) | 235 PluginProcessInfo plugin_proc) |
| 236 : plugin_process_(plugin_proc), | 236 : plugin_process_(plugin_proc), |
| 237 title_(), | 237 title_(), |
| 238 network_usage_support_(false) { | 238 network_usage_support_(false) { |
| 239 pid_ = process_util::GetProcId(plugin_proc.process()); | 239 pid_ = base::GetProcId(plugin_proc.process()); |
| 240 if (!default_icon_) { | 240 if (!default_icon_) { |
| 241 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 241 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 242 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); | 242 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 TaskManagerPluginProcessResource::~TaskManagerPluginProcessResource() { | 246 TaskManagerPluginProcessResource::~TaskManagerPluginProcessResource() { |
| 247 } | 247 } |
| 248 | 248 |
| 249 // TaskManagerResource methods: | 249 // TaskManagerResource methods: |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 // Finally, delete the resource. | 393 // Finally, delete the resource. |
| 394 delete resource; | 394 delete resource; |
| 395 } | 395 } |
| 396 | 396 |
| 397 void TaskManagerPluginProcessResourceProvider::AddToTaskManager( | 397 void TaskManagerPluginProcessResourceProvider::AddToTaskManager( |
| 398 PluginProcessInfo plugin_process_info) { | 398 PluginProcessInfo plugin_process_info) { |
| 399 TaskManagerPluginProcessResource* resource = | 399 TaskManagerPluginProcessResource* resource = |
| 400 new TaskManagerPluginProcessResource(plugin_process_info); | 400 new TaskManagerPluginProcessResource(plugin_process_info); |
| 401 resources_[plugin_process_info] = resource; | 401 resources_[plugin_process_info] = resource; |
| 402 pid_to_resources_[process_util::GetProcId(plugin_process_info.process())] = | 402 pid_to_resources_[base::GetProcId(plugin_process_info.process())] = |
| 403 resource; | 403 resource; |
| 404 task_manager_->AddResource(resource); | 404 task_manager_->AddResource(resource); |
| 405 } | 405 } |
| 406 | 406 |
| 407 // The PluginProcessIterator has to be used from the IO thread. | 407 // The PluginProcessIterator has to be used from the IO thread. |
| 408 void TaskManagerPluginProcessResourceProvider::RetrievePluginProcessInfo() { | 408 void TaskManagerPluginProcessResourceProvider::RetrievePluginProcessInfo() { |
| 409 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) { | 409 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) { |
| 410 PluginProcessHost* plugin = const_cast<PluginProcessHost*>(*iter); | 410 PluginProcessHost* plugin = const_cast<PluginProcessHost*>(*iter); |
| 411 DCHECK(plugin->process()); | 411 DCHECK(plugin->process()); |
| 412 PluginProcessInfo plugin_info(plugin->dll_path(), plugin->process()); | 412 PluginProcessInfo plugin_info(plugin->dll_path(), plugin->process()); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 502 } |
| 503 | 503 |
| 504 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 504 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
| 505 task_manager_->AddResource(&resource_); | 505 task_manager_->AddResource(&resource_); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 508 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| OLD | NEW |