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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1235 // GetResourceWebContents returns a pointer to the relevant web contents for | 1235 // GetResourceWebContents returns a pointer to the relevant web contents for |
1236 // the resource. If the index doesn't correspond to any web contents | 1236 // the resource. If the index doesn't correspond to any web contents |
1237 // (i.e. refers to the Browser process or a plugin), GetWebContents will | 1237 // (i.e. refers to the Browser process or a plugin), GetWebContents will |
1238 // return NULL. | 1238 // return NULL. |
1239 WebContents* chosen_web_contents = model_->GetResourceWebContents(index); | 1239 WebContents* chosen_web_contents = model_->GetResourceWebContents(index); |
1240 if (chosen_web_contents && chosen_web_contents->GetDelegate()) | 1240 if (chosen_web_contents && chosen_web_contents->GetDelegate()) |
1241 chosen_web_contents->GetDelegate()->ActivateContents(chosen_web_contents); | 1241 chosen_web_contents->GetDelegate()->ActivateContents(chosen_web_contents); |
1242 } | 1242 } |
1243 | 1243 |
1244 void TaskManager::AddResource(Resource* resource) { | 1244 void TaskManager::AddResource(Resource* resource) { |
1245 model_->AddResource(resource); | 1245 model_->AddResource(resource); |
Ben Goodger (Google)
2012/10/03 19:16:56
indent off
robertshield
2012/10/03 19:58:17
Done.
| |
1246 } | 1246 } |
1247 | 1247 |
1248 void TaskManager::RemoveResource(Resource* resource) { | 1248 void TaskManager::RemoveResource(Resource* resource) { |
1249 model_->RemoveResource(resource); | 1249 model_->RemoveResource(resource); |
1250 } | 1250 } |
1251 | 1251 |
1252 void TaskManager::OnWindowClosed() { | 1252 void TaskManager::OnWindowClosed() { |
1253 model_->StopUpdating(); | 1253 model_->StopUpdating(); |
1254 } | 1254 } |
1255 | 1255 |
1256 void TaskManager::ModelChanged() { | 1256 void TaskManager::ModelChanged() { |
1257 model_->ModelChanged(); | 1257 model_->ModelChanged(); |
1258 } | 1258 } |
1259 | 1259 |
1260 // static | 1260 // static |
1261 TaskManager* TaskManager::GetInstance() { | 1261 TaskManager* TaskManager::GetInstance() { |
1262 return Singleton<TaskManager>::get(); | 1262 return Singleton<TaskManager>::get(); |
1263 } | 1263 } |
1264 | 1264 |
1265 void TaskManager::OpenAboutMemory() { | 1265 void TaskManager::OpenAboutMemory() { |
1266 // TODO(robertshield): FTB - Merge MAD's TaskManager change. | |
1266 Browser* browser = browser::FindOrCreateTabbedBrowser( | 1267 Browser* browser = browser::FindOrCreateTabbedBrowser( |
1267 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 1268 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
1268 chrome::NavigateParams params(browser, GURL(chrome::kChromeUIMemoryURL), | 1269 chrome::NavigateParams params(browser, GURL(chrome::kChromeUIMemoryURL), |
1269 content::PAGE_TRANSITION_LINK); | 1270 content::PAGE_TRANSITION_LINK); |
1270 params.disposition = NEW_FOREGROUND_TAB; | 1271 params.disposition = NEW_FOREGROUND_TAB; |
1271 chrome::Navigate(¶ms); | 1272 chrome::Navigate(¶ms); |
1272 } | 1273 } |
1273 | 1274 |
1274 bool TaskManagerModel::GetAndCacheMemoryMetrics(base::ProcessHandle handle, | 1275 bool TaskManagerModel::GetAndCacheMemoryMetrics(base::ProcessHandle handle, |
1275 MemoryUsageEntry* usage) const { | 1276 MemoryUsageEntry* usage) const { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1326 // Count the number of extensions with background pages (including | 1327 // Count the number of extensions with background pages (including |
1327 // incognito). | 1328 // incognito). |
1328 count += CountExtensionBackgroundPagesForProfile(profile); | 1329 count += CountExtensionBackgroundPagesForProfile(profile); |
1329 if (profile->HasOffTheRecordProfile()) { | 1330 if (profile->HasOffTheRecordProfile()) { |
1330 count += CountExtensionBackgroundPagesForProfile( | 1331 count += CountExtensionBackgroundPagesForProfile( |
1331 profile->GetOffTheRecordProfile()); | 1332 profile->GetOffTheRecordProfile()); |
1332 } | 1333 } |
1333 } | 1334 } |
1334 return count; | 1335 return count; |
1335 } | 1336 } |
OLD | NEW |