From 5f7b6c265895c0021af511ce73a1241b407395dd Mon Sep 17 00:00:00 2001 From: dgrogan Date: Tue, 21 Jul 2015 16:43:09 -0700 Subject: Make quota logic obey durable storage permission When the quota database is asked for the least recently used origin for eviction it should not return any origins that have been granted the durable storage permission. Note that there is no easy way for a user to set this permission yet. That is coming in https://codereview.chromium.org/1164073005/ and https://codereview.chromium.org/1154573005/ BUG=482814 Review URL: https://codereview.chromium.org/1229933007 Cr-Commit-Position: refs/heads/master@{#339783} --- components/content_settings/core/browser/cookie_settings.cc | 12 ++++++++++++ components/content_settings/core/browser/cookie_settings.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'components/content_settings') diff --git a/components/content_settings/core/browser/cookie_settings.cc b/components/content_settings/core/browser/cookie_settings.cc index 94ffb39..7c82a4e 100644 --- a/components/content_settings/core/browser/cookie_settings.cc +++ b/components/content_settings/core/browser/cookie_settings.cc @@ -75,6 +75,7 @@ bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const { void CookieSettings::GetCookieSettings( ContentSettingsForOneType* settings) const { + // TODO(dgrogan): Why is this returning a value in a void function? return host_content_settings_map_->GetSettingsForOneType( CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings); } @@ -113,6 +114,17 @@ void CookieSettings::ResetCookieSetting( std::string(), CONTENT_SETTING_DEFAULT); } +bool CookieSettings::IsStorageDurable(const GURL& origin) const { + // TODO(dgrogan): DCHECK somewhere that secondary doesn't get set for DURABLE. + // TODO(dgrogan): Should "resource_identifier" be something other than + // std::string()? + ContentSetting setting = host_content_settings_map_->GetContentSetting( + origin /*primary*/, origin /*secondary*/, + CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, + std::string() /*resource_identifier*/); + return setting == CONTENT_SETTING_ALLOW; +} + void CookieSettings::ShutdownOnUIThread() { DCHECK(thread_checker_.CalledOnValidThread()); pref_change_registrar_.RemoveAll(); diff --git a/components/content_settings/core/browser/cookie_settings.h b/components/content_settings/core/browser/cookie_settings.h index 063e7e6..31057e8 100644 --- a/components/content_settings/core/browser/cookie_settings.h +++ b/components/content_settings/core/browser/cookie_settings.h @@ -90,6 +90,8 @@ class CookieSettings : public RefcountedKeyedService { void ResetCookieSetting(const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern); + bool IsStorageDurable(const GURL& origin) const; + // Detaches the |CookieSettings| from |PrefService|. This methods needs to be // called before destroying the service. Afterwards, only const methods can be // called. -- cgit v1.1