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

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

Issue 2351803002: Switching ExtensionSpecialStoragePolicy::IsStorageDurable to use DurableStoragePermissionContext. (Closed)
Patch Set: Switching IsStorageDurable() to use DurableStoragePermissionContext. Created 4 years, 2 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
« no previous file with comments | « components/content_settings/core/browser/cookie_settings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/content_settings/core/browser/content_settings_utils.h" 9 #include "components/content_settings/core/browser/content_settings_utils.h"
10 #include "components/content_settings/core/browser/host_content_settings_map.h" 10 #include "components/content_settings/core/browser/host_content_settings_map.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 primary_url, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), 99 primary_url, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
100 setting); 100 setting);
101 } 101 }
102 102
103 void CookieSettings::ResetCookieSetting(const GURL& primary_url) { 103 void CookieSettings::ResetCookieSetting(const GURL& primary_url) {
104 host_content_settings_map_->SetNarrowestContentSetting( 104 host_content_settings_map_->SetNarrowestContentSetting(
105 primary_url, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, 105 primary_url, GURL(), CONTENT_SETTINGS_TYPE_COOKIES,
106 CONTENT_SETTING_DEFAULT); 106 CONTENT_SETTING_DEFAULT);
107 } 107 }
108 108
109 bool CookieSettings::IsStorageDurable(const GURL& origin) const {
110 // TODO(dgrogan): Don't use host_content_settings_map_ directly.
111 // https://crbug.com/539538
112 ContentSetting setting = host_content_settings_map_->GetContentSetting(
113 origin /*primary*/, origin /*secondary*/,
114 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE,
115 std::string() /*resource_identifier*/);
116 return setting == CONTENT_SETTING_ALLOW;
117 }
118
119 void CookieSettings::ShutdownOnUIThread() { 109 void CookieSettings::ShutdownOnUIThread() {
120 DCHECK(thread_checker_.CalledOnValidThread()); 110 DCHECK(thread_checker_.CalledOnValidThread());
121 pref_change_registrar_.RemoveAll(); 111 pref_change_registrar_.RemoveAll();
122 } 112 }
123 113
124 ContentSetting CookieSettings::GetCookieSetting(const GURL& url, 114 ContentSetting CookieSettings::GetCookieSetting(const GURL& url,
125 const GURL& first_party_url, 115 const GURL& first_party_url,
126 bool setting_cookie, 116 bool setting_cookie,
127 SettingSource* source) const { 117 SettingSource* source) const {
128 // Auto-allow in extensions or for WebUI embedded in a secure origin. 118 // Auto-allow in extensions or for WebUI embedded in a secure origin.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( 168 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean(
179 prefs::kBlockThirdPartyCookies); 169 prefs::kBlockThirdPartyCookies);
180 } 170 }
181 171
182 bool CookieSettings::ShouldBlockThirdPartyCookies() const { 172 bool CookieSettings::ShouldBlockThirdPartyCookies() const {
183 base::AutoLock auto_lock(lock_); 173 base::AutoLock auto_lock(lock_);
184 return block_third_party_cookies_; 174 return block_third_party_cookies_;
185 } 175 }
186 176
187 } // namespace content_settings 177 } // namespace content_settings
OLDNEW
« no previous file with comments | « components/content_settings/core/browser/cookie_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698