summaryrefslogtreecommitdiff
path: root/chromium/components/content_settings/core/browser/cookie_settings.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/content_settings/core/browser/cookie_settings.cc')
-rw-r--r--chromium/components/content_settings/core/browser/cookie_settings.cc61
1 files changed, 0 insertions, 61 deletions
diff --git a/chromium/components/content_settings/core/browser/cookie_settings.cc b/chromium/components/content_settings/core/browser/cookie_settings.cc
index a1252ad44ce..47430eec6e8 100644
--- a/chromium/components/content_settings/core/browser/cookie_settings.cc
+++ b/chromium/components/content_settings/core/browser/cookie_settings.cc
@@ -16,25 +16,8 @@
#include "extensions/buildflags/buildflags.h"
#include "net/base/net_errors.h"
#include "net/base/static_cookie_policy.h"
-#include "net/cookies/cookie_util.h"
#include "url/gurl.h"
-namespace {
-
-bool IsValidSetting(ContentSetting setting) {
- return (setting == CONTENT_SETTING_ALLOW ||
- setting == CONTENT_SETTING_SESSION_ONLY ||
- setting == CONTENT_SETTING_BLOCK);
-}
-
-bool IsAllowed(ContentSetting setting) {
- DCHECK(IsValidSetting(setting));
- return (setting == CONTENT_SETTING_ALLOW ||
- setting == CONTENT_SETTING_SESSION_ONLY);
-}
-
-} // namespace
-
namespace content_settings {
CookieSettings::CookieSettings(
@@ -58,50 +41,6 @@ ContentSetting CookieSettings::GetDefaultCookieSetting(
CONTENT_SETTINGS_TYPE_COOKIES, provider_id);
}
-bool CookieSettings::IsCookieAccessAllowed(const GURL& url,
- const GURL& first_party_url) const {
- ContentSetting setting;
- GetCookieSetting(url, first_party_url, nullptr, &setting);
- return IsAllowed(setting);
-}
-
-bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const {
- ContentSetting setting;
- GetCookieSetting(origin, origin, nullptr, &setting);
- DCHECK(IsValidSetting(setting));
- return (setting == CONTENT_SETTING_SESSION_ONLY);
-}
-
-bool CookieSettings::ShouldDeleteCookieOnExit(
- const ContentSettingsForOneType& cookie_settings,
- const std::string& domain,
- bool is_https) const {
- GURL origin = net::cookie_util::CookieOriginToURL(domain, is_https);
- ContentSetting setting;
- GetCookieSetting(origin, origin, nullptr, &setting);
- DCHECK(IsValidSetting(setting));
- if (setting == CONTENT_SETTING_ALLOW)
- return false;
- // Non-secure cookies are readable by secure sites. We need to check for
- // https pattern if http is not allowed. The section below is independent
- // of the scheme so we can just retry from here.
- if (!is_https)
- return ShouldDeleteCookieOnExit(cookie_settings, domain, true);
- // Check if there is a more precise rule that "domain matches" this cookie.
- bool matches_session_only_rule = false;
- for (const auto& entry : cookie_settings) {
- const std::string& host = entry.primary_pattern.GetHost();
- if (net::cookie_util::IsDomainMatch(domain, host)) {
- if (entry.GetContentSetting() == CONTENT_SETTING_ALLOW) {
- return false;
- } else if (entry.GetContentSetting() == CONTENT_SETTING_SESSION_ONLY) {
- matches_session_only_rule = true;
- }
- }
- }
- return setting == CONTENT_SETTING_SESSION_ONLY || matches_session_only_rule;
-}
-
void CookieSettings::GetCookieSettings(
ContentSettingsForOneType* settings) const {
host_content_settings_map_->GetSettingsForOneType(