summaryrefslogtreecommitdiffstats
path: root/components/content_settings
diff options
context:
space:
mode:
authordgrogan <dgrogan@chromium.org>2015-07-21 16:43:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-21 23:44:44 +0000
commit5f7b6c265895c0021af511ce73a1241b407395dd (patch)
treedc64c061ab479410e1a63cf686e74c2e4a1b69c9 /components/content_settings
parentc71cc2ecf056ccb59249ba156d927f087bcae28b (diff)
downloadchromium_src-5f7b6c265895c0021af511ce73a1241b407395dd.zip
chromium_src-5f7b6c265895c0021af511ce73a1241b407395dd.tar.gz
chromium_src-5f7b6c265895c0021af511ce73a1241b407395dd.tar.bz2
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}
Diffstat (limited to 'components/content_settings')
-rw-r--r--components/content_settings/core/browser/cookie_settings.cc12
-rw-r--r--components/content_settings/core/browser/cookie_settings.h2
2 files changed, 14 insertions, 0 deletions
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.