OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 Browser* browser = BrowserList::GetLastActive(); | 937 Browser* browser = BrowserList::GetLastActive(); |
938 | 938 |
939 if (!browser) { | 939 if (!browser) { |
940 // On OS X, the task manager can be open without any open browser windows. | 940 // On OS X, the task manager can be open without any open browser windows. |
941 if (!g_browser_process || | 941 if (!g_browser_process || |
942 !g_browser_process->profile_manager() || | 942 !g_browser_process->profile_manager() || |
943 g_browser_process->profile_manager()->begin() == | 943 g_browser_process->profile_manager()->begin() == |
944 g_browser_process->profile_manager()->end()) | 944 g_browser_process->profile_manager()->end()) |
945 return; | 945 return; |
946 browser = Browser::Create(*g_browser_process->profile_manager()->begin()); | 946 browser = Browser::Create(*g_browser_process->profile_manager()->begin()); |
947 browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_WINDOW, | 947 browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, |
948 PageTransition::LINK); | 948 PageTransition::LINK); |
| 949 browser->window()->Show(); |
949 } else { | 950 } else { |
950 browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, | 951 browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, |
951 PageTransition::LINK); | 952 PageTransition::LINK); |
952 | 953 |
953 // In case the browser window is minimzed, show it. If |browser| is a | 954 // In case the browser window is minimzed, show it. If |browser| is a |
954 // non-tabbed window, the call to OpenURL above will have opened a | 955 // non-tabbed window, the call to OpenURL above will have opened a |
955 // TabContents in a tabbed browser, so we need to grab it with GetLastActive | 956 // TabContents in a tabbed browser, so we need to grab it with GetLastActive |
956 // before the call to show(). | 957 // before the call to show(). |
957 if (browser->type() & (Browser::TYPE_APP | | 958 if (browser->type() & (Browser::TYPE_APP | |
958 Browser::TYPE_DEVTOOLS | | 959 Browser::TYPE_DEVTOOLS | |
(...skipping 12 matching lines...) Expand all Loading... |
971 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 972 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
972 if (iter == metrics_map_.end()) | 973 if (iter == metrics_map_.end()) |
973 return false; | 974 return false; |
974 | 975 |
975 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) | 976 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) |
976 return false; | 977 return false; |
977 | 978 |
978 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 979 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
979 return true; | 980 return true; |
980 } | 981 } |
OLD | NEW |