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.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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/task_manager/task_manager_resource_providers.h" | 24 #include "chrome/browser/task_manager/task_manager_resource_providers.h" |
25 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" | 25 #include "chrome/browser/task_manager/task_manager_worker_resource_provider.h" |
26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.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/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "chrome/common/view_type.h" | 30 #include "chrome/common/view_type.h" |
31 #include "content/public/browser/browser_child_process_host.h" | 31 #include "content/public/browser/browser_child_process_host.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
34 #include "content/public/browser/render_view_host_delegate.h" | |
35 #include "content/public/browser/resource_request_info.h" | 34 #include "content/public/browser/resource_request_info.h" |
36 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/browser/web_contents_delegate.h" |
37 #include "content/public/common/result_codes.h" | 37 #include "content/public/common/result_codes.h" |
38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
40 #include "grit/ui_resources.h" | 40 #include "grit/ui_resources.h" |
41 #include "third_party/skia/include/core/SkBitmap.h" | 41 #include "third_party/skia/include/core/SkBitmap.h" |
42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
44 #include "ui/base/text/bytes_formatting.h" | 44 #include "ui/base/text/bytes_formatting.h" |
45 #include "unicode/coll.h" | 45 #include "unicode/coll.h" |
46 | 46 |
47 using content::BrowserThread; | 47 using content::BrowserThread; |
48 using content::OpenURLParams; | 48 using content::OpenURLParams; |
49 using content::Referrer; | 49 using content::Referrer; |
50 using content::ResourceRequestInfo; | 50 using content::ResourceRequestInfo; |
| 51 using content::WebContents; |
51 | 52 |
52 namespace { | 53 namespace { |
53 | 54 |
54 // The delay between updates of the information (in ms). | 55 // The delay between updates of the information (in ms). |
55 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
56 // Match Activity Monitor's default refresh rate. | 57 // Match Activity Monitor's default refresh rate. |
57 const int kUpdateTimeMs = 2000; | 58 const int kUpdateTimeMs = 2000; |
58 #else | 59 #else |
59 const int kUpdateTimeMs = 1000; | 60 const int kUpdateTimeMs = 1000; |
60 #endif | 61 #endif |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 base::KillProcess(process, content::RESULT_CODE_KILLED, false); | 1093 base::KillProcess(process, content::RESULT_CODE_KILLED, false); |
1093 } | 1094 } |
1094 | 1095 |
1095 void TaskManager::ActivateProcess(int index) { | 1096 void TaskManager::ActivateProcess(int index) { |
1096 // GetResourceTabContents returns a pointer to the relevant tab contents for | 1097 // GetResourceTabContents returns a pointer to the relevant tab contents for |
1097 // the resource. If the index doesn't correspond to a Tab (i.e. refers to | 1098 // the resource. If the index doesn't correspond to a Tab (i.e. refers to |
1098 // the Browser process or a plugin), GetTabContents will return NULL. | 1099 // the Browser process or a plugin), GetTabContents will return NULL. |
1099 TabContentsWrapper* chosen_tab_contents = | 1100 TabContentsWrapper* chosen_tab_contents = |
1100 model_->GetResourceTabContents(index); | 1101 model_->GetResourceTabContents(index); |
1101 if (chosen_tab_contents) { | 1102 if (chosen_tab_contents) { |
1102 chosen_tab_contents->web_contents()->GetRenderViewHost()->GetDelegate()-> | 1103 WebContents* web_contents = chosen_tab_contents->web_contents(); |
1103 Activate(); | 1104 web_contents->GetDelegate()->ActivateContents(web_contents); |
1104 } | 1105 } |
1105 } | 1106 } |
1106 | 1107 |
1107 void TaskManager::AddResource(Resource* resource) { | 1108 void TaskManager::AddResource(Resource* resource) { |
1108 model_->AddResource(resource); | 1109 model_->AddResource(resource); |
1109 } | 1110 } |
1110 | 1111 |
1111 void TaskManager::RemoveResource(Resource* resource) { | 1112 void TaskManager::RemoveResource(Resource* resource) { |
1112 model_->RemoveResource(resource); | 1113 model_->RemoveResource(resource); |
1113 } | 1114 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 // Count the number of extensions with background pages (including | 1189 // Count the number of extensions with background pages (including |
1189 // incognito). | 1190 // incognito). |
1190 count += CountExtensionBackgroundPagesForProfile(profile); | 1191 count += CountExtensionBackgroundPagesForProfile(profile); |
1191 if (profile->HasOffTheRecordProfile()) { | 1192 if (profile->HasOffTheRecordProfile()) { |
1192 count += CountExtensionBackgroundPagesForProfile( | 1193 count += CountExtensionBackgroundPagesForProfile( |
1193 profile->GetOffTheRecordProfile()); | 1194 profile->GetOffTheRecordProfile()); |
1194 } | 1195 } |
1195 } | 1196 } |
1196 return count; | 1197 return count; |
1197 } | 1198 } |
OLD | NEW |