OLD | NEW |
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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 registry->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, | 70 registry->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, |
71 false, | 71 false, |
72 PrefRegistrySyncable::SYNCABLE_PREF); | 72 PrefRegistrySyncable::SYNCABLE_PREF); |
73 } | 73 } |
74 | 74 |
75 bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { | 75 bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { |
76 return true; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 scoped_refptr<RefcountedProfileKeyedService> | 79 scoped_refptr<RefcountedProfileKeyedService> |
80 CookieSettings::Factory::BuildServiceInstanceFor(Profile* profile) const { | 80 CookieSettings::Factory::BuildServiceInstanceFor( |
| 81 content::BrowserContext* context) const { |
| 82 Profile* profile = static_cast<Profile*>(context); |
81 return new CookieSettings(profile->GetHostContentSettingsMap(), | 83 return new CookieSettings(profile->GetHostContentSettingsMap(), |
82 profile->GetPrefs()); | 84 profile->GetPrefs()); |
83 } | 85 } |
84 | 86 |
85 CookieSettings::CookieSettings( | 87 CookieSettings::CookieSettings( |
86 HostContentSettingsMap* host_content_settings_map, | 88 HostContentSettingsMap* host_content_settings_map, |
87 PrefService* prefs) | 89 PrefService* prefs) |
88 : host_content_settings_map_(host_content_settings_map), | 90 : host_content_settings_map_(host_content_settings_map), |
89 block_third_party_cookies_( | 91 block_third_party_cookies_( |
90 prefs->GetBoolean(prefs::kBlockThirdPartyCookies)) { | 92 prefs->GetBoolean(prefs::kBlockThirdPartyCookies)) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 224 |
223 base::AutoLock auto_lock(lock_); | 225 base::AutoLock auto_lock(lock_); |
224 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( | 226 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( |
225 prefs::kBlockThirdPartyCookies); | 227 prefs::kBlockThirdPartyCookies); |
226 } | 228 } |
227 | 229 |
228 bool CookieSettings::ShouldBlockThirdPartyCookies() const { | 230 bool CookieSettings::ShouldBlockThirdPartyCookies() const { |
229 base::AutoLock auto_lock(lock_); | 231 base::AutoLock auto_lock(lock_); |
230 return block_third_party_cookies_; | 232 return block_third_party_cookies_; |
231 } | 233 } |
OLD | NEW |