Chromium Code Reviews| Index: chrome/browser/ui/browser.cc |
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
| index f438efd2273adeda29b552ea373597101c6020ed..149ee1ff8c4228340f804bf6ec78c54fcb26720b 100644 |
| --- a/chrome/browser/ui/browser.cc |
| +++ b/chrome/browser/ui/browser.cc |
| @@ -34,6 +34,8 @@ |
| #include "chrome/browser/background/background_contents_service_factory.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browser_shutdown.h" |
| +#include "chrome/browser/browsing_data/browsing_data_helper.h" |
| +#include "chrome/browser/browsing_data/browsing_data_remover.h" |
| #include "chrome/browser/character_encoding.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| @@ -511,9 +513,20 @@ Browser::~Browser() { |
| if (profile_->IsOffTheRecord() && |
| !BrowserList::IsOffTheRecordSessionActiveForProfile(profile_)) { |
| - // An incognito profile is no longer needed, this indirectly frees |
| - // its cache and cookies once it gets destroyed at the appropriate time. |
| - ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); |
| + if (profile_->IsGuestSession()) { |
|
Peter Kasting
2015/02/10 21:43:36
How come the incognito codepath doesn't actually w
Mike Lerman
2015/02/10 21:53:32
I've modified the comment to explain why we're doi
Peter Kasting
2015/02/10 21:58:10
OK, the new comment is better, but I still don't r
Mike Lerman
2015/02/11 15:15:32
You're exactly right. DestroyProfileWhenAppropriat
|
| + // Clear all browsing data once a Guest Session completes. |
| + // TODO(mlerman): Delete the guest |profile_| completely instead. |
| + BrowsingDataRemover* data_remover = |
| + BrowsingDataRemover::CreateForUnboundedRange(profile_); |
| + data_remover->Remove(BrowsingDataRemover::REMOVE_ALL ^ |
| + BrowsingDataRemover::REMOVE_DOWNLOADS, |
| + BrowsingDataHelper::ALL); |
| + // BrowsingDataRemover deletes itself. |
| + } else { |
| + // An incognito profile is no longer needed, this indirectly frees |
| + // its cache and cookies once it gets destroyed at the appropriate time. |
| + ProfileDestroyer::DestroyProfileWhenAppropriate(profile_); |
| + } |
| } |
| // There may be pending file dialogs, we need to tell them that we've gone |