| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/debugger/devtools_window.h" | 10 #include "chrome/browser/debugger/devtools_window.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 TaskManagerNotificationResource::TaskManagerNotificationResource( | 32 TaskManagerNotificationResource::TaskManagerNotificationResource( |
| 33 BalloonHost* balloon_host) | 33 BalloonHost* balloon_host) |
| 34 : balloon_host_(balloon_host) { | 34 : balloon_host_(balloon_host) { |
| 35 if (!default_icon_) { | 35 if (!default_icon_) { |
| 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 37 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); | 37 default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN); |
| 38 } | 38 } |
| 39 process_handle_ = | 39 process_handle_ = |
| 40 balloon_host_->web_contents()->GetRenderProcessHost()->GetHandle(); | 40 balloon_host_->web_contents()->GetRenderProcessHost()->GetHandle(); |
| 41 unique_process_id_ = |
| 42 balloon_host_->web_contents()->GetRenderProcessHost()->GetID(); |
| 41 pid_ = base::GetProcId(process_handle_); | 43 pid_ = base::GetProcId(process_handle_); |
| 42 title_ = l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NOTIFICATION_PREFIX, | 44 title_ = l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NOTIFICATION_PREFIX, |
| 43 balloon_host_->GetSource()); | 45 balloon_host_->GetSource()); |
| 44 } | 46 } |
| 45 | 47 |
| 46 TaskManagerNotificationResource::~TaskManagerNotificationResource() { | 48 TaskManagerNotificationResource::~TaskManagerNotificationResource() { |
| 47 } | 49 } |
| 48 | 50 |
| 49 string16 TaskManagerNotificationResource::GetTitle() const { | 51 string16 TaskManagerNotificationResource::GetTitle() const { |
| 50 return title_; | 52 return title_; |
| 51 } | 53 } |
| 52 | 54 |
| 53 string16 TaskManagerNotificationResource::GetProfileName() const { | 55 string16 TaskManagerNotificationResource::GetProfileName() const { |
| 54 return string16(); | 56 return string16(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 SkBitmap TaskManagerNotificationResource::GetIcon() const { | 59 SkBitmap TaskManagerNotificationResource::GetIcon() const { |
| 58 return *default_icon_; | 60 return *default_icon_; |
| 59 } | 61 } |
| 60 | 62 |
| 61 base::ProcessHandle TaskManagerNotificationResource::GetProcess() const { | 63 base::ProcessHandle TaskManagerNotificationResource::GetProcess() const { |
| 62 return process_handle_; | 64 return process_handle_; |
| 63 } | 65 } |
| 64 | 66 |
| 67 int TaskManagerNotificationResource::GetUniqueChildProcessId() const { |
| 68 return unique_process_id_; |
| 69 } |
| 70 |
| 65 TaskManager::Resource::Type TaskManagerNotificationResource::GetType() const { | 71 TaskManager::Resource::Type TaskManagerNotificationResource::GetType() const { |
| 66 return NOTIFICATION; | 72 return NOTIFICATION; |
| 67 } | 73 } |
| 68 | 74 |
| 69 bool TaskManagerNotificationResource::CanInspect() const { | 75 bool TaskManagerNotificationResource::CanInspect() const { |
| 70 return true; | 76 return true; |
| 71 } | 77 } |
| 72 | 78 |
| 73 void TaskManagerNotificationResource::Inspect() const { | 79 void TaskManagerNotificationResource::Inspect() const { |
| 74 DevToolsWindow::OpenDevToolsWindow( | 80 DevToolsWindow::OpenDevToolsWindow( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Remove the resource from the Task Manager. | 186 // Remove the resource from the Task Manager. |
| 181 TaskManagerNotificationResource* resource = iter->second; | 187 TaskManagerNotificationResource* resource = iter->second; |
| 182 task_manager_->RemoveResource(resource); | 188 task_manager_->RemoveResource(resource); |
| 183 | 189 |
| 184 // Remove it from the map. | 190 // Remove it from the map. |
| 185 resources_.erase(iter); | 191 resources_.erase(iter); |
| 186 | 192 |
| 187 // Finally, delete the resource. | 193 // Finally, delete the resource. |
| 188 delete resource; | 194 delete resource; |
| 189 } | 195 } |
| OLD | NEW |