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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1124 } |
1125 | 1125 |
1126 namespace { | 1126 namespace { |
1127 | 1127 |
1128 // Counts the number of extension background pages associated with this profile. | 1128 // Counts the number of extension background pages associated with this profile. |
1129 int CountExtensionBackgroundPagesForProfile(Profile* profile) { | 1129 int CountExtensionBackgroundPagesForProfile(Profile* profile) { |
1130 int count = 0; | 1130 int count = 0; |
1131 ExtensionProcessManager* manager = profile->GetExtensionProcessManager(); | 1131 ExtensionProcessManager* manager = profile->GetExtensionProcessManager(); |
1132 if (!manager) | 1132 if (!manager) |
1133 return count; | 1133 return count; |
1134 for (ExtensionProcessManager::const_iterator iter = manager->begin(); | 1134 |
1135 iter != manager->end(); | 1135 const ExtensionProcessManager::ExtensionHostSet& background_hosts = |
1136 ++iter) { | 1136 manager->background_hosts(); |
1137 if ((*iter)->extension_host_type() == | 1137 for (ExtensionProcessManager::const_iterator iter = background_hosts.begin(); |
1138 chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 1138 iter != background_hosts.end(); ++iter) { |
1139 count++; | 1139 ++count; |
1140 } | |
1141 } | 1140 } |
1142 return count; | 1141 return count; |
1143 } | 1142 } |
1144 | 1143 |
1145 } // namespace | 1144 } // namespace |
1146 | 1145 |
1147 // static | 1146 // static |
1148 int TaskManager::GetBackgroundPageCount() { | 1147 int TaskManager::GetBackgroundPageCount() { |
1149 int count = 0; | 1148 int count = 0; |
1150 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1149 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
(...skipping 15 matching lines...) Expand all Loading... |
1166 // Count the number of extensions with background pages (including | 1165 // Count the number of extensions with background pages (including |
1167 // incognito). | 1166 // incognito). |
1168 count += CountExtensionBackgroundPagesForProfile(profile); | 1167 count += CountExtensionBackgroundPagesForProfile(profile); |
1169 if (profile->HasOffTheRecordProfile()) { | 1168 if (profile->HasOffTheRecordProfile()) { |
1170 count += CountExtensionBackgroundPagesForProfile( | 1169 count += CountExtensionBackgroundPagesForProfile( |
1171 profile->GetOffTheRecordProfile()); | 1170 profile->GetOffTheRecordProfile()); |
1172 } | 1171 } |
1173 } | 1172 } |
1174 return count; | 1173 return count; |
1175 } | 1174 } |
OLD | NEW |