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

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

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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 "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"
11 #include "components/content_settings/core/common/content_settings_pattern.h" 11 #include "components/content_settings/core/common/content_settings_pattern.h"
12 #include "components/content_settings/core/common/pref_names.h" 12 #include "components/content_settings/core/common/pref_names.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 13 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
15 #include "extensions/features/features.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"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace { 20 namespace {
20 21
21 bool IsValidSetting(ContentSetting setting) { 22 bool IsValidSetting(ContentSetting setting) {
22 return (setting == CONTENT_SETTING_ALLOW || 23 return (setting == CONTENT_SETTING_ALLOW ||
23 setting == CONTENT_SETTING_SESSION_ONLY || 24 setting == CONTENT_SETTING_SESSION_ONLY ||
24 setting == CONTENT_SETTING_BLOCK); 25 setting == CONTENT_SETTING_BLOCK);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 123 }
123 124
124 ContentSetting CookieSettings::GetCookieSetting(const GURL& url, 125 ContentSetting CookieSettings::GetCookieSetting(const GURL& url,
125 const GURL& first_party_url, 126 const GURL& first_party_url,
126 bool setting_cookie, 127 bool setting_cookie,
127 SettingSource* source) const { 128 SettingSource* source) const {
128 // Auto-allow in extensions or for WebUI embedded in a secure origin. 129 // Auto-allow in extensions or for WebUI embedded in a secure origin.
129 if (url.SchemeIsCryptographic() && first_party_url.SchemeIs(kChromeUIScheme)) 130 if (url.SchemeIsCryptographic() && first_party_url.SchemeIs(kChromeUIScheme))
130 return CONTENT_SETTING_ALLOW; 131 return CONTENT_SETTING_ALLOW;
131 132
132 #if defined(ENABLE_EXTENSIONS) 133 #if BUILDFLAG(ENABLE_EXTENSIONS)
133 if (url.SchemeIs(kExtensionScheme) && 134 if (url.SchemeIs(kExtensionScheme) &&
134 first_party_url.SchemeIs(kExtensionScheme)) { 135 first_party_url.SchemeIs(kExtensionScheme)) {
135 return CONTENT_SETTING_ALLOW; 136 return CONTENT_SETTING_ALLOW;
136 } 137 }
137 #endif 138 #endif
138 139
139 // First get any host-specific settings. 140 // First get any host-specific settings.
140 SettingInfo info; 141 SettingInfo info;
141 std::unique_ptr<base::Value> value = 142 std::unique_ptr<base::Value> value =
142 host_content_settings_map_->GetWebsiteSetting( 143 host_content_settings_map_->GetWebsiteSetting(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( 179 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean(
179 prefs::kBlockThirdPartyCookies); 180 prefs::kBlockThirdPartyCookies);
180 } 181 }
181 182
182 bool CookieSettings::ShouldBlockThirdPartyCookies() const { 183 bool CookieSettings::ShouldBlockThirdPartyCookies() const {
183 base::AutoLock auto_lock(lock_); 184 base::AutoLock auto_lock(lock_);
184 return block_third_party_cookies_; 185 return block_third_party_cookies_;
185 } 186 }
186 187
187 } // namespace content_settings 188 } // namespace content_settings
OLDNEW
« no previous file with comments | « components/content_settings/core/browser/DEPS ('k') | components/content_settings/core/browser/cookie_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698