Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: components/content_settings/core/browser/cookie_settings.cc

Issue 1229933007: Make quota logic obey durable storage permission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_top_durable
Patch Set: fix extensions_browsertests compile Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/content_settings/core/browser/cookie_settings.h" 5 #include "components/content_settings/core/browser/cookie_settings.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "components/content_settings/core/browser/content_settings_utils.h" 10 #include "components/content_settings/core/browser/content_settings_utils.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const { 70 bool CookieSettings::IsCookieSessionOnly(const GURL& origin) const {
71 ContentSetting setting = GetCookieSetting(origin, origin, true, NULL); 71 ContentSetting setting = GetCookieSetting(origin, origin, true, NULL);
72 DCHECK(IsValidSetting(setting)); 72 DCHECK(IsValidSetting(setting));
73 return (setting == CONTENT_SETTING_SESSION_ONLY); 73 return (setting == CONTENT_SETTING_SESSION_ONLY);
74 } 74 }
75 75
76 void CookieSettings::GetCookieSettings( 76 void CookieSettings::GetCookieSettings(
77 ContentSettingsForOneType* settings) const { 77 ContentSettingsForOneType* settings) const {
78 // TODO(dgrogan): Why is this returning a value in a void function?
78 return host_content_settings_map_->GetSettingsForOneType( 79 return host_content_settings_map_->GetSettingsForOneType(
79 CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings); 80 CONTENT_SETTINGS_TYPE_COOKIES, std::string(), settings);
80 } 81 }
81 82
82 void CookieSettings::RegisterProfilePrefs( 83 void CookieSettings::RegisterProfilePrefs(
83 user_prefs::PrefRegistrySyncable* registry) { 84 user_prefs::PrefRegistrySyncable* registry) {
84 registry->RegisterBooleanPref( 85 registry->RegisterBooleanPref(
85 prefs::kBlockThirdPartyCookies, false, 86 prefs::kBlockThirdPartyCookies, false,
86 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 87 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
87 } 88 }
(...skipping 18 matching lines...) Expand all
106 } 107 }
107 108
108 void CookieSettings::ResetCookieSetting( 109 void CookieSettings::ResetCookieSetting(
109 const ContentSettingsPattern& primary_pattern, 110 const ContentSettingsPattern& primary_pattern,
110 const ContentSettingsPattern& secondary_pattern) { 111 const ContentSettingsPattern& secondary_pattern) {
111 host_content_settings_map_->SetContentSetting( 112 host_content_settings_map_->SetContentSetting(
112 primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES, 113 primary_pattern, secondary_pattern, CONTENT_SETTINGS_TYPE_COOKIES,
113 std::string(), CONTENT_SETTING_DEFAULT); 114 std::string(), CONTENT_SETTING_DEFAULT);
114 } 115 }
115 116
117 bool CookieSettings::IsStorageDurable(const GURL& origin) const {
118 // TODO(dgrogan): DCHECK somewhere that secondary doesn't get set for DURABLE.
119 // TODO(dgrogan): Should "resource_identifier" be something other than
120 // std::string()?
121 ContentSetting setting = host_content_settings_map_->GetContentSetting(
122 origin /*primary*/, origin /*secondary*/,
123 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE,
124 std::string() /*resource_identifier*/);
125 return setting == CONTENT_SETTING_ALLOW;
126 }
127
116 void CookieSettings::ShutdownOnUIThread() { 128 void CookieSettings::ShutdownOnUIThread() {
117 DCHECK(thread_checker_.CalledOnValidThread()); 129 DCHECK(thread_checker_.CalledOnValidThread());
118 pref_change_registrar_.RemoveAll(); 130 pref_change_registrar_.RemoveAll();
119 } 131 }
120 132
121 ContentSetting CookieSettings::GetCookieSetting(const GURL& url, 133 ContentSetting CookieSettings::GetCookieSetting(const GURL& url,
122 const GURL& first_party_url, 134 const GURL& first_party_url,
123 bool setting_cookie, 135 bool setting_cookie,
124 SettingSource* source) const { 136 SettingSource* source) const {
125 if (HostContentSettingsMap::ShouldAllowAllContent( 137 if (HostContentSettingsMap::ShouldAllowAllContent(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( 179 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean(
168 prefs::kBlockThirdPartyCookies); 180 prefs::kBlockThirdPartyCookies);
169 } 181 }
170 182
171 bool CookieSettings::ShouldBlockThirdPartyCookies() const { 183 bool CookieSettings::ShouldBlockThirdPartyCookies() const {
172 base::AutoLock auto_lock(lock_); 184 base::AutoLock auto_lock(lock_);
173 return block_third_party_cookies_; 185 return block_third_party_cookies_;
174 } 186 }
175 187
176 } // namespace content_settings 188 } // namespace content_settings
OLDNEW
« no previous file with comments | « components/content_settings/core/browser/cookie_settings.h ('k') | content/browser/quota/quota_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698