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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 // On OS X, the task manager can be open without any open browser windows. | 1028 // On OS X, the task manager can be open without any open browser windows. |
1029 if (!g_browser_process || !g_browser_process->profile_manager()) | 1029 if (!g_browser_process || !g_browser_process->profile_manager()) |
1030 return; | 1030 return; |
1031 Profile* profile = | 1031 Profile* profile = |
1032 g_browser_process->profile_manager()->GetLastUsedProfile(); | 1032 g_browser_process->profile_manager()->GetLastUsedProfile(); |
1033 if (!profile) | 1033 if (!profile) |
1034 return; | 1034 return; |
1035 browser = Browser::Create(profile); | 1035 browser = Browser::Create(profile); |
1036 browser->OpenURL(GURL(chrome::kChromeUIMemoryURL), GURL(), | 1036 browser->OpenURL(GURL(chrome::kChromeUIMemoryURL), GURL(), |
1037 NEW_FOREGROUND_TAB, PageTransition::LINK); | 1037 NEW_FOREGROUND_TAB, PageTransition::LINK); |
1038 browser->window()->Show(); | 1038 browser->window()->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
1039 } else { | 1039 } else { |
1040 browser->OpenURL(GURL(chrome::kChromeUIMemoryURL), GURL(), | 1040 browser->OpenURL(GURL(chrome::kChromeUIMemoryURL), GURL(), |
1041 NEW_FOREGROUND_TAB, PageTransition::LINK); | 1041 NEW_FOREGROUND_TAB, PageTransition::LINK); |
1042 | 1042 |
1043 // In case the browser window is minimzed, show it. If |browser| is a | 1043 // In case the browser window is minimzed, show it. If |browser| is a |
1044 // non-tabbed window, the call to OpenURL above will have opened a | 1044 // non-tabbed window, the call to OpenURL above will have opened a |
1045 // TabContents in a tabbed browser, so we need to grab it with GetLastActive | 1045 // TabContents in a tabbed browser, so we need to grab it with GetLastActive |
1046 // before the call to show(). | 1046 // before the call to show(). |
1047 if (!browser->is_type_tabbed()) { | 1047 if (!browser->is_type_tabbed()) { |
1048 browser = BrowserList::GetLastActive(); | 1048 browser = BrowserList::GetLastActive(); |
1049 DCHECK(browser); | 1049 DCHECK(browser); |
1050 } | 1050 } |
1051 | 1051 |
1052 browser->window()->Show(); | 1052 browser->window()->Show(BrowserWindow::SHOW_CONTEXT_NORMAL); |
1053 } | 1053 } |
1054 } | 1054 } |
1055 | 1055 |
1056 bool TaskManagerModel::GetAndCacheMemoryMetrics( | 1056 bool TaskManagerModel::GetAndCacheMemoryMetrics( |
1057 base::ProcessHandle handle, | 1057 base::ProcessHandle handle, |
1058 std::pair<size_t, size_t>* usage) const { | 1058 std::pair<size_t, size_t>* usage) const { |
1059 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 1059 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
1060 if (iter == metrics_map_.end()) | 1060 if (iter == metrics_map_.end()) |
1061 return false; | 1061 return false; |
1062 | 1062 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 // Count the number of extensions with background pages (including | 1108 // Count the number of extensions with background pages (including |
1109 // incognito). | 1109 // incognito). |
1110 count += CountExtensionBackgroundPagesForProfile(profile); | 1110 count += CountExtensionBackgroundPagesForProfile(profile); |
1111 if (profile->HasOffTheRecordProfile()) { | 1111 if (profile->HasOffTheRecordProfile()) { |
1112 count += CountExtensionBackgroundPagesForProfile( | 1112 count += CountExtensionBackgroundPagesForProfile( |
1113 profile->GetOffTheRecordProfile()); | 1113 profile->GetOffTheRecordProfile()); |
1114 } | 1114 } |
1115 } | 1115 } |
1116 return count; | 1116 return count; |
1117 } | 1117 } |
OLD | NEW |