| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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.h" | 5 #include "chrome/browser/task_manager.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 const { | 330 const { |
| 331 DCHECK(index < ResourceCount()); | 331 DCHECK(index < ResourceCount()); |
| 332 return resources_[index]->GetProcess(); | 332 return resources_[index]->GetProcess(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 TabContents* TaskManagerModel::GetResourceTabContents(int index) const { | 335 TabContents* TaskManagerModel::GetResourceTabContents(int index) const { |
| 336 DCHECK(index < ResourceCount()); | 336 DCHECK(index < ResourceCount()); |
| 337 return resources_[index]->GetTabContents(); | 337 return resources_[index]->GetTabContents(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 const Extension* TaskManagerModel::GetResourceExtension(int index) const { |
| 341 DCHECK(index < ResourceCount()); |
| 342 return resources_[index]->GetExtension(); |
| 343 } |
| 344 |
| 340 int64 TaskManagerModel::GetNetworkUsage(TaskManager::Resource* resource) | 345 int64 TaskManagerModel::GetNetworkUsage(TaskManager::Resource* resource) |
| 341 const { | 346 const { |
| 342 int64 net_usage = GetNetworkUsageForResource(resource); | 347 int64 net_usage = GetNetworkUsageForResource(resource); |
| 343 if (net_usage == 0 && !resource->SupportNetworkUsage()) | 348 if (net_usage == 0 && !resource->SupportNetworkUsage()) |
| 344 return -1; | 349 return -1; |
| 345 return net_usage; | 350 return net_usage; |
| 346 } | 351 } |
| 347 | 352 |
| 348 int TaskManagerModel::GetCPUUsage(TaskManager::Resource* resource) const { | 353 int TaskManagerModel::GetCPUUsage(TaskManager::Resource* resource) const { |
| 349 CPUUsageMap::const_iterator iter = | 354 CPUUsageMap::const_iterator iter = |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 // or popup, we can only have one tab, hence we need to process this in a | 850 // or popup, we can only have one tab, hence we need to process this in a |
| 846 // tabbed browser window. Currently, |browser| is pointing to the application, | 851 // tabbed browser window. Currently, |browser| is pointing to the application, |
| 847 // popup window. Therefore, we have to retrieve the last active tab again, | 852 // popup window. Therefore, we have to retrieve the last active tab again, |
| 848 // since a new window has been used. | 853 // since a new window has been used. |
| 849 if (browser->type() & Browser::TYPE_APP_POPUP) { | 854 if (browser->type() & Browser::TYPE_APP_POPUP) { |
| 850 browser = BrowserList::GetLastActive(); | 855 browser = BrowserList::GetLastActive(); |
| 851 DCHECK(browser); | 856 DCHECK(browser); |
| 852 } | 857 } |
| 853 browser->window()->Show(); | 858 browser->window()->Show(); |
| 854 } | 859 } |
| OLD | NEW |