diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 13:02:23 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 13:02:23 +0000 |
commit | 474e5dbb88bbfadc06f661e8af9f8c98604e280c (patch) | |
tree | 6d38366661ba08a3278522f1fc2846f9f9af2a94 | |
parent | 3f9ba45ed5ff0cbeff601d0ef2a1e3397dc2ad8c (diff) | |
download | chromium_src-474e5dbb88bbfadc06f661e8af9f8c98604e280c.zip chromium_src-474e5dbb88bbfadc06f661e8af9f8c98604e280c.tar.gz chromium_src-474e5dbb88bbfadc06f661e8af9f8c98604e280c.tar.bz2 |
Ensure that incognito profiles are correctly destroyed when all incognito windows belonging to a given profile have been closed.
BUG=92437
TEST=see bug
Review URL: http://codereview.chromium.org/7622005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96549 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/task_manager/task_manager_resource_providers.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_list.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/browser_list.h | 3 |
4 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 969add8..c404fc42 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -1087,7 +1087,7 @@ void TaskManagerExtensionProcessResourceProvider::StartUpdating() { // If we have an incognito profile active, include the split-mode incognito // extensions. - if (BrowserList::IsOffTheRecordSessionActive()) { + if (BrowserList::IsOffTheRecordSessionActiveForProfile(profiles[i])) { ExtensionProcessManager* process_manager = profiles[i]->GetOffTheRecordProfile()->GetExtensionProcessManager(); if (process_manager) { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 68d1172..2de9e92 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -388,7 +388,7 @@ Browser::~Browser() { use_compact_navigation_bar_.Destroy(); if (profile_->IsOffTheRecord() && - !BrowserList::IsOffTheRecordSessionActive()) { + !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { // An incognito profile is no longer needed, this indirectly // frees its cache and cookies. profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc index ac7aa30..37b5425 100644 --- a/chrome/browser/ui/browser_list.cc +++ b/chrome/browser/ui/browser_list.cc @@ -700,6 +700,17 @@ bool BrowserList::IsOffTheRecordSessionActive() { } return false; } +// static +bool BrowserList::IsOffTheRecordSessionActiveForProfile(Profile* profile) { + for (BrowserList::const_iterator i = BrowserList::begin(); + i != BrowserList::end(); ++i) { + if ((*i)->profile()->IsSameProfile(profile) && + (*i)->profile()->IsOffTheRecord()) { + return true; + } + } + return false; +} // static void BrowserList::RemoveBrowserFrom(Browser* browser, diff --git a/chrome/browser/ui/browser_list.h b/chrome/browser/ui/browser_list.h index 2d2d026..3b3f061 100644 --- a/chrome/browser/ui/browser_list.h +++ b/chrome/browser/ui/browser_list.h @@ -195,6 +195,9 @@ class BrowserList { // Returns true if at least one incognito session is active. static bool IsOffTheRecordSessionActive(); + // Returns true if at least one incognito session is active for |profile|. + static bool IsOffTheRecordSessionActiveForProfile(Profile* profile); + // Send out notifications. // For ChromeOS, also request session manager to end the session. static void NotifyAndTerminate(bool fast_path); |