Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6103)

Unified Diff: chrome/browser/ui/browser.cc

Issue 888843005: Closing a guest session clears all browsing history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CrOS passes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index f438efd2273adeda29b552ea373597101c6020ed..2f5337ef1ab77e07c9b730f62c253611465bd148 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,24 @@ 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()) {
+// ChromeOS handles guest data independently.
+#if !defined(OS_CHROMEOS)
+ // 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,
+ BrowsingDataHelper::ALL);
+ // BrowsingDataRemover deletes itself.
+#endif
+ } 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
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | chrome/browser/ui/browser_command_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698