summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-14 18:10:46 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-14 18:10:46 +0000
commit7bf10b0e47e51d9c6d0a5f39a9d0bfad1d78eef4 (patch)
treeab94f83583d52df0ae33e7cea84d7c188db1509c
parentaaeb8e99eb08a3ba2367be0814bf5ec1f07b20ad (diff)
downloadchromium_src-7bf10b0e47e51d9c6d0a5f39a9d0bfad1d78eef4.zip
chromium_src-7bf10b0e47e51d9c6d0a5f39a9d0bfad1d78eef4.tar.gz
chromium_src-7bf10b0e47e51d9c6d0a5f39a9d0bfad1d78eef4.tar.bz2
Task Manager on Mac OS X may fire without an open browser window. If a user calls for the "about:memory" page to be displayed, display it in a browser window attached to the last active profile, instead of the "default" profile. This will make the Task Manager do the right thing in a multi-profile environment.
BUG=83792 TEST=Task Manager opens the "stats for nerds" page on Mac OS X without any browser window open, using last active profile. Review URL: http://codereview.chromium.org/7148015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89026 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/profiles/profile_manager.cc8
-rw-r--r--chrome/browser/profiles/profile_manager.h3
-rw-r--r--chrome/browser/task_manager/task_manager.cc2
3 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 7a66ef3..8b20ab3 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -78,6 +78,14 @@ Profile* ProfileManager::GetDefaultProfile() {
return profile_manager->GetDefaultProfile(user_data_dir);
}
+// static
+Profile* ProfileManager::GetLastUsedProfile() {
+ FilePath user_data_dir;
+ PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ return profile_manager->GetLastUsedProfile(user_data_dir);
+}
+
ProfileManager::ProfileManager() : logged_in_(false) {
BrowserList::AddObserver(this);
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index e16aeb6..c532a77 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -96,6 +96,9 @@ class ProfileManager : public base::NonThreadSafe,
// been stored in Local State, hand back the Default profile.
Profile* GetLastUsedProfile(const FilePath& user_data_dir);
+ // Same as instance method but provides the default user_data_dir as well.
+ static Profile* GetLastUsedProfile();
+
// Register the mapping of a directory to a profile name in Local State.
void RegisterProfileName(Profile* profile);
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 4fe6403..a8709b9 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -954,7 +954,7 @@ void TaskManager::OpenAboutMemory() {
if (!g_browser_process || !g_browser_process->profile_manager())
return;
Profile* profile =
- g_browser_process->profile_manager()->GetDefaultProfile();
+ g_browser_process->profile_manager()->GetLastUsedProfile();
if (!profile)
return;
browser = Browser::Create(profile);