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

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

Issue 1569673002: [NOT FOR LANDING] Detailed loading traces Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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/trace_event/trace_event.h"
7 #include "base/bind.h" 8 #include "base/bind.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "components/content_settings/core/browser/content_settings_utils.h" 10 #include "components/content_settings/core/browser/content_settings_utils.h"
10 #include "components/content_settings/core/browser/host_content_settings_map.h" 11 #include "components/content_settings/core/browser/host_content_settings_map.h"
11 #include "components/content_settings/core/common/content_settings_pattern.h" 12 #include "components/content_settings/core/common/content_settings_pattern.h"
12 #include "components/content_settings/core/common/pref_names.h" 13 #include "components/content_settings/core/common/pref_names.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 14 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/prefs/pref_service.h" 15 #include "components/prefs/pref_service.h"
15 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
16 #include "net/base/static_cookie_policy.h" 17 #include "net/base/static_cookie_policy.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 51 }
51 52
52 ContentSetting CookieSettings::GetDefaultCookieSetting( 53 ContentSetting CookieSettings::GetDefaultCookieSetting(
53 std::string* provider_id) const { 54 std::string* provider_id) const {
54 return host_content_settings_map_->GetDefaultContentSetting( 55 return host_content_settings_map_->GetDefaultContentSetting(
55 CONTENT_SETTINGS_TYPE_COOKIES, provider_id); 56 CONTENT_SETTINGS_TYPE_COOKIES, provider_id);
56 } 57 }
57 58
58 bool CookieSettings::IsReadingCookieAllowed(const GURL& url, 59 bool CookieSettings::IsReadingCookieAllowed(const GURL& url,
59 const GURL& first_party_url) const { 60 const GURL& first_party_url) const {
61 TRACE_EVENT0("toplevel", "CookieSettings::IsReadingCookieAllowed");
60 ContentSetting setting = GetCookieSetting(url, first_party_url, false, NULL); 62 ContentSetting setting = GetCookieSetting(url, first_party_url, false, NULL);
61 return IsAllowed(setting); 63 return IsAllowed(setting);
62 } 64 }
63 65
64 bool CookieSettings::IsSettingCookieAllowed(const GURL& url, 66 bool CookieSettings::IsSettingCookieAllowed(const GURL& url,
65 const GURL& first_party_url) const { 67 const GURL& first_party_url) const {
66 ContentSetting setting = GetCookieSetting(url, first_party_url, true, NULL); 68 ContentSetting setting = GetCookieSetting(url, first_party_url, true, NULL);
67 return IsAllowed(setting); 69 return IsAllowed(setting);
68 } 70 }
69 71
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 127
126 void CookieSettings::ShutdownOnUIThread() { 128 void CookieSettings::ShutdownOnUIThread() {
127 DCHECK(thread_checker_.CalledOnValidThread()); 129 DCHECK(thread_checker_.CalledOnValidThread());
128 pref_change_registrar_.RemoveAll(); 130 pref_change_registrar_.RemoveAll();
129 } 131 }
130 132
131 ContentSetting CookieSettings::GetCookieSetting(const GURL& url, 133 ContentSetting CookieSettings::GetCookieSetting(const GURL& url,
132 const GURL& first_party_url, 134 const GURL& first_party_url,
133 bool setting_cookie, 135 bool setting_cookie,
134 SettingSource* source) const { 136 SettingSource* source) const {
137 TRACE_EVENT0("toplevel", "CookieSettings::GetCookieSetting");
138
135 // Auto-allow in extensions or for WebUI embedded in a secure origin. 139 // Auto-allow in extensions or for WebUI embedded in a secure origin.
136 if (url.SchemeIsCryptographic() && first_party_url.SchemeIs(kChromeUIScheme)) 140 if (url.SchemeIsCryptographic() && first_party_url.SchemeIs(kChromeUIScheme))
137 return CONTENT_SETTING_ALLOW; 141 return CONTENT_SETTING_ALLOW;
138 142
139 #if defined(ENABLE_EXTENSIONS) 143 #if defined(ENABLE_EXTENSIONS)
140 if (url.SchemeIs(kExtensionScheme) && 144 if (url.SchemeIs(kExtensionScheme) &&
141 first_party_url.SchemeIs(kExtensionScheme)) { 145 first_party_url.SchemeIs(kExtensionScheme)) {
142 return CONTENT_SETTING_ALLOW; 146 return CONTENT_SETTING_ALLOW;
143 } 147 }
144 #endif 148 #endif
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( 188 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean(
185 prefs::kBlockThirdPartyCookies); 189 prefs::kBlockThirdPartyCookies);
186 } 190 }
187 191
188 bool CookieSettings::ShouldBlockThirdPartyCookies() const { 192 bool CookieSettings::ShouldBlockThirdPartyCookies() const {
189 base::AutoLock auto_lock(lock_); 193 base::AutoLock auto_lock(lock_);
190 return block_third_party_cookies_; 194 return block_third_party_cookies_;
191 } 195 }
192 196
193 } // namespace content_settings 197 } // namespace content_settings
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_database.cc ('k') | components/safe_browsing_db/prefix_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698