diff options
Diffstat (limited to 'chrome/browser')
| -rw-r--r-- | chrome/browser/browser.cc | 10 | ||||
| -rw-r--r-- | chrome/browser/profile.cc | 9 | ||||
| -rw-r--r-- | chrome/browser/profile.h | 4 |
3 files changed, 16 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(); |
