summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 19:50:59 +0000
committeridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 19:50:59 +0000
commit860f55497abe0123f3c4a6a139ccd84f13d892be (patch)
tree0da2d275be23012e8f4cb603e677b01db9e6646f
parentc3ef3429eba3f39db64176ab7a2d722fde388725 (diff)
downloadchromium_src-860f55497abe0123f3c4a6a139ccd84f13d892be.zip
chromium_src-860f55497abe0123f3c4a6a139ccd84f13d892be.tar.gz
chromium_src-860f55497abe0123f3c4a6a139ccd84f13d892be.tar.bz2
Issue 348: can view old incognito cache if main process left running
Same place we clear cookies when the last incognito window is closed, destroy the entire incognito profile which by implication destoys the incognito cache. BUG=348 Review URL: http://codereview.chromium.org/53101 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12688 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc10
-rw-r--r--chrome/browser/profile.cc9
-rw-r--r--chrome/browser/profile.h4
-rw-r--r--chrome/test/testing_profile.h3
4 files changed, 19 insertions, 7 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 59b8157..410411e 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -232,13 +232,9 @@ Browser::~Browser() {
if (profile_->IsOffTheRecord() &&
!BrowserList::IsOffTheRecordSessionActive()) {
- // We reuse the OTR cookie store across OTR windows. If the last OTR
- // window is closed, then we want to wipe the cookie store clean, so when
- // an OTR window is open again, it starts with an empty cookie store. This
- // also frees up the memory that the OTR cookies were using. OTR never
- // loads or writes persistent cookies (there is no backing store), so we
- // can just delete all of the cookies in the store.
- profile_->GetRequestContext()->cookie_store()->DeleteAll(false);
+ // An off-the-record profile is no longer needed, this indirectly
+ // frees its cache and cookies.
+ profile_->GetOriginalProfile()->DestroyOffTheRecordProfile();
}
// There may be pending file dialogs, we need to tell them that we've gone
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 08b3260..a290fa0 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -138,6 +138,11 @@ class OffTheRecordProfileImpl : public Profile,
return this;
}
+ virtual void DestroyOffTheRecordProfile() {
+ // Suicide is bad!
+ NOTREACHED();
+ }
+
virtual Profile* GetOriginalProfile() {
return profile_;
}
@@ -504,6 +509,10 @@ Profile* ProfileImpl::GetOffTheRecordProfile() {
return off_the_record_profile_.get();
}
+void ProfileImpl::DestroyOffTheRecordProfile() {
+ off_the_record_profile_.reset();
+}
+
Profile* ProfileImpl::GetOriginalProfile() {
return this;
}
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h
index 7e48419..236d5cf 100644
--- a/chrome/browser/profile.h
+++ b/chrome/browser/profile.h
@@ -93,6 +93,9 @@ class Profile {
// record, the same profile is returned.
virtual Profile* GetOffTheRecordProfile() = 0;
+ // Destroys the off the record profile.
+ virtual void DestroyOffTheRecordProfile() = 0;
+
// Return the original "recording" profile. This method returns this if the
// profile is not off the record.
virtual Profile* GetOriginalProfile() = 0;
@@ -268,6 +271,7 @@ class ProfileImpl : public Profile,
virtual FilePath GetPath();
virtual bool IsOffTheRecord();
virtual Profile* GetOffTheRecordProfile();
+ virtual void DestroyOffTheRecordProfile();
virtual Profile* GetOriginalProfile();
virtual VisitedLinkMaster* GetVisitedLinkMaster();
virtual UserScriptMaster* GetUserScriptMaster();
diff --git a/chrome/test/testing_profile.h b/chrome/test/testing_profile.h
index 3472e52..fe3848d 100644
--- a/chrome/test/testing_profile.h
+++ b/chrome/test/testing_profile.h
@@ -72,6 +72,9 @@ class TestingProfile : public Profile {
virtual Profile* GetOffTheRecordProfile() {
return NULL;
}
+
+ virtual void DestroyOffTheRecordProfile() {}
+
virtual Profile* GetOriginalProfile() {
return this;
}