| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/i18n/number_formatting.h" | 9 #include "base/i18n/number_formatting.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
| 22 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/browser/task_manager/task_manager_resource_providers.h" | 23 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
| 24 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" | 24 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" |
| 25 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
| 26 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 28 #include "chrome/common/chrome_view_type.h" | 28 #include "chrome/common/chrome_view_type.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "content/browser/renderer_host/render_view_host.h" |
| 32 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 31 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 33 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 32 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 34 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
| 33 #include "content/browser/tab_contents/tab_contents.h" | |
| 34 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/web_contents.h" |
| 35 #include "content/public/common/result_codes.h" | 37 #include "content/public/common/result_codes.h" |
| 36 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
| 37 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
| 38 #include "grit/ui_resources.h" | 40 #include "grit/ui_resources.h" |
| 39 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "ui/base/text/bytes_formatting.h" | 43 #include "ui/base/text/bytes_formatting.h" |
| 42 #include "unicode/coll.h" | 44 #include "unicode/coll.h" |
| 43 | 45 |
| 44 #if defined(OS_MACOSX) | 46 #if defined(OS_MACOSX) |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 base::KillProcess(process, content::RESULT_CODE_KILLED, false); | 1031 base::KillProcess(process, content::RESULT_CODE_KILLED, false); |
| 1030 } | 1032 } |
| 1031 | 1033 |
| 1032 void TaskManager::ActivateProcess(int index) { | 1034 void TaskManager::ActivateProcess(int index) { |
| 1033 // GetResourceTabContents returns a pointer to the relevant tab contents for | 1035 // GetResourceTabContents returns a pointer to the relevant tab contents for |
| 1034 // the resource. If the index doesn't correspond to a Tab (i.e. refers to | 1036 // the resource. If the index doesn't correspond to a Tab (i.e. refers to |
| 1035 // the Browser process or a plugin), GetTabContents will return NULL. | 1037 // the Browser process or a plugin), GetTabContents will return NULL. |
| 1036 TabContentsWrapper* chosen_tab_contents = | 1038 TabContentsWrapper* chosen_tab_contents = |
| 1037 model_->GetResourceTabContents(index); | 1039 model_->GetResourceTabContents(index); |
| 1038 if (chosen_tab_contents) { | 1040 if (chosen_tab_contents) { |
| 1039 static_cast<RenderViewHostDelegate*>(chosen_tab_contents->tab_contents())-> | 1041 chosen_tab_contents->web_contents()->GetRenderViewHost()->delegate()-> |
| 1040 Activate(); | 1042 Activate(); |
| 1041 } | 1043 } |
| 1042 } | 1044 } |
| 1043 | 1045 |
| 1044 void TaskManager::AddResource(Resource* resource) { | 1046 void TaskManager::AddResource(Resource* resource) { |
| 1045 model_->AddResource(resource); | 1047 model_->AddResource(resource); |
| 1046 } | 1048 } |
| 1047 | 1049 |
| 1048 void TaskManager::RemoveResource(Resource* resource) { | 1050 void TaskManager::RemoveResource(Resource* resource) { |
| 1049 model_->RemoveResource(resource); | 1051 model_->RemoveResource(resource); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 // Count the number of extensions with background pages (including | 1152 // Count the number of extensions with background pages (including |
| 1151 // incognito). | 1153 // incognito). |
| 1152 count += CountExtensionBackgroundPagesForProfile(profile); | 1154 count += CountExtensionBackgroundPagesForProfile(profile); |
| 1153 if (profile->HasOffTheRecordProfile()) { | 1155 if (profile->HasOffTheRecordProfile()) { |
| 1154 count += CountExtensionBackgroundPagesForProfile( | 1156 count += CountExtensionBackgroundPagesForProfile( |
| 1155 profile->GetOffTheRecordProfile()); | 1157 profile->GetOffTheRecordProfile()); |
| 1156 } | 1158 } |
| 1157 } | 1159 } |
| 1158 return count; | 1160 return count; |
| 1159 } | 1161 } |
| OLD | NEW |