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

Side by Side Diff: chrome/browser/content_settings/cookie_settings.cc

Issue 542253003: Add a global on/off switch for content settings and expose a toggle on the Website Settings options… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@global-settings
Patch Set: Rebase. Created 6 years, 3 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 "chrome/browser/content_settings/cookie_settings.h" 5 #include "chrome/browser/content_settings/cookie_settings.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/content_settings/content_settings_utils.h" 9 #include "chrome/browser/content_settings/content_settings_utils.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const GURL& url, 176 const GURL& url,
177 const GURL& first_party_url, 177 const GURL& first_party_url,
178 bool setting_cookie, 178 bool setting_cookie,
179 content_settings::SettingSource* source) const { 179 content_settings::SettingSource* source) const {
180 if (HostContentSettingsMap::ShouldAllowAllContent( 180 if (HostContentSettingsMap::ShouldAllowAllContent(
181 url, first_party_url, CONTENT_SETTINGS_TYPE_COOKIES)) 181 url, first_party_url, CONTENT_SETTINGS_TYPE_COOKIES))
182 return CONTENT_SETTING_ALLOW; 182 return CONTENT_SETTING_ALLOW;
183 183
184 // First get any host-specific settings. 184 // First get any host-specific settings.
185 content_settings::SettingInfo info; 185 content_settings::SettingInfo info;
186 scoped_ptr<base::Value> value(host_content_settings_map_->GetWebsiteSetting( 186 scoped_ptr<base::Value> value = host_content_settings_map_->GetWebsiteSetting(
187 url, 187 url,
188 first_party_url, 188 first_party_url,
189 CONTENT_SETTINGS_TYPE_COOKIES, 189 CONTENT_SETTINGS_TYPE_COOKIES,
190 std::string(), 190 std::string(),
191 &info)); 191 &info);
192 if (source) 192 if (source)
193 *source = info.source; 193 *source = info.source;
194 194
195 // If no explicit exception has been made and third-party cookies are blocked 195 // If no explicit exception has been made and third-party cookies are blocked
196 // by default, apply that rule. 196 // by default, apply that rule.
197 if (info.primary_pattern.MatchesAllHosts() && 197 if (info.primary_pattern.MatchesAllHosts() &&
198 info.secondary_pattern.MatchesAllHosts() && 198 info.secondary_pattern.MatchesAllHosts() &&
199 ShouldBlockThirdPartyCookies() && 199 ShouldBlockThirdPartyCookies() &&
200 !first_party_url.SchemeIs(extensions::kExtensionScheme)) { 200 !first_party_url.SchemeIs(extensions::kExtensionScheme)) {
201 net::StaticCookiePolicy policy( 201 net::StaticCookiePolicy policy(
(...skipping 20 matching lines...) Expand all
222 222
223 base::AutoLock auto_lock(lock_); 223 base::AutoLock auto_lock(lock_);
224 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( 224 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean(
225 prefs::kBlockThirdPartyCookies); 225 prefs::kBlockThirdPartyCookies);
226 } 226 }
227 227
228 bool CookieSettings::ShouldBlockThirdPartyCookies() const { 228 bool CookieSettings::ShouldBlockThirdPartyCookies() const {
229 base::AutoLock auto_lock(lock_); 229 base::AutoLock auto_lock(lock_);
230 return block_third_party_cookies_; 230 return block_third_party_cookies_;
231 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698