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..95ef5133f65564225691356f783cdc3669c32b16 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,22 @@ 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()) { |
| + // Clear all browsing data once a Guest Session completes. The Guest |
| + // profile has BrowserContextKeyedServices that the Incognito profile |
| + // doesn't, so the ProfileDestroyer can't delete it properly. |
| + // TODO(mlerman): Delete the guest using an improved ProfileDestroyer. |
| + BrowsingDataRemover* data_remover = |
| + BrowsingDataRemover::CreateForUnboundedRange(profile_); |
| + data_remover->Remove(BrowsingDataRemover::REMOVE_ALL ^ |
| + BrowsingDataRemover::REMOVE_DOWNLOADS, |
|
battre
2015/02/11 15:19:25
Looking at https://developer.chrome.com/extensions
Bernhard Bauer
2015/02/11 16:04:28
Yup, we never delete downloaded files.
Mike Lerman
2015/02/12 15:36:23
Okay. Done.
|
| + 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 |