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

Unified Diff: chrome/browser/profiles/profile_destroyer.cc

Issue 853743002: First pass at fixing guest browser cookies issue. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete the Profile Manager. Guest Profile doesn't write to autocomplete/history. Views still needs … 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
« no previous file with comments | « chrome/browser/profiles/profile_destroyer.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_destroyer.cc
diff --git a/chrome/browser/profiles/profile_destroyer.cc b/chrome/browser/profiles/profile_destroyer.cc
index 5ce9aaa4c3796ca8484347ef00281ce5a4f63b4b..91d795ba230f493da013c36770af8cf9983a2747 100644
--- a/chrome/browser/profiles/profile_destroyer.cc
+++ b/chrome/browser/profiles/profile_destroyer.cc
@@ -8,7 +8,12 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/trace_event/trace_event.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/user_manager.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
namespace {
@@ -57,8 +62,9 @@ void ProfileDestroyer::DestroyProfileWhenAppropriate(Profile* const profile) {
if (hosts.empty() || !profile->IsOffTheRecord()) {
if (profile->IsOffTheRecord())
profile->GetOriginalProfile()->DestroyOffTheRecordProfile();
- else
+ else { DLOG(ERROR) << "Delete the profile! " << profile->GetPath().MaybeAsASCII();
delete profile;
+ }
} else {
// The instance will destroy itself once all render process hosts referring
// to it are properly terminated.
@@ -89,6 +95,28 @@ void ProfileDestroyer::DestroyOffTheRecordProfileNow(Profile* const profile) {
profile->GetOriginalProfile()->DestroyOffTheRecordProfile();
}
+// static
+void ProfileDestroyer::DestroyGuestProfileIfAppropriate() {
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ DCHECK(profile_manager);
+ Profile* guest_profile = profile_manager->
+ GetProfileByPath(ProfileManager::GetGuestProfilePath());
+ DLOG(ERROR) << "Calling DestroyGuestProfileIfAppropriate!";
+ if (!guest_profile)
+ return;
+
+ if (BrowserList::IsOffTheRecordSessionActiveForProfile(guest_profile))
+ return;
+
+ DLOG(ERROR) << "Deleting the Guest Profile!";
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&ProfileDestroyer::DestroyProfileWhenAppropriate,
+ guest_profile));
+}
+
ProfileDestroyer::ProfileDestroyer(Profile* const profile, HostSet* hosts)
: timer_(false, false),
num_hosts_(0),
@@ -155,7 +183,7 @@ void ProfileDestroyer::DestroyProfile() {
return;
}
- DCHECK(profile_->IsOffTheRecord());
+ DCHECK(profile_->IsOffTheRecord() || profile_->IsGuestSession());
DCHECK(profile_->GetOriginalProfile());
profile_->GetOriginalProfile()->DestroyOffTheRecordProfile();
profile_ = NULL;
« no previous file with comments | « chrome/browser/profiles/profile_destroyer.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698