| 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 "chrome/browser/content_settings/content_settings_utils.h" | 8 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 CookieSettings::Factory::Factory() | 59 CookieSettings::Factory::Factory() |
| 60 : RefcountedProfileKeyedServiceFactory( | 60 : RefcountedProfileKeyedServiceFactory( |
| 61 "CookieSettings", | 61 "CookieSettings", |
| 62 ProfileDependencyManager::GetInstance()) { | 62 ProfileDependencyManager::GetInstance()) { |
| 63 } | 63 } |
| 64 | 64 |
| 65 CookieSettings::Factory::~Factory() {} | 65 CookieSettings::Factory::~Factory() {} |
| 66 | 66 |
| 67 void CookieSettings::Factory::RegisterUserPrefs(PrefService* user_prefs) { | 67 void CookieSettings::Factory::RegisterUserPrefs( |
| 68 PrefServiceSyncable* user_prefs) { |
| 68 user_prefs->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, | 69 user_prefs->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, |
| 69 false, | 70 false, |
| 70 PrefService::SYNCABLE_PREF); | 71 PrefServiceSyncable::SYNCABLE_PREF); |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { | 74 bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { |
| 74 return true; | 75 return true; |
| 75 } | 76 } |
| 76 | 77 |
| 77 scoped_refptr<RefcountedProfileKeyedService> | 78 scoped_refptr<RefcountedProfileKeyedService> |
| 78 CookieSettings::Factory::BuildServiceInstanceFor(Profile* profile) const { | 79 CookieSettings::Factory::BuildServiceInstanceFor(Profile* profile) const { |
| 79 return new CookieSettings(profile->GetHostContentSettingsMap(), | 80 return new CookieSettings(profile->GetHostContentSettingsMap(), |
| 80 profile->GetPrefs()); | 81 profile->GetPrefs()); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 214 |
| 214 base::AutoLock auto_lock(lock_); | 215 base::AutoLock auto_lock(lock_); |
| 215 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( | 216 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( |
| 216 prefs::kBlockThirdPartyCookies); | 217 prefs::kBlockThirdPartyCookies); |
| 217 } | 218 } |
| 218 | 219 |
| 219 bool CookieSettings::ShouldBlockThirdPartyCookies() const { | 220 bool CookieSettings::ShouldBlockThirdPartyCookies() const { |
| 220 base::AutoLock auto_lock(lock_); | 221 base::AutoLock auto_lock(lock_); |
| 221 return block_third_party_cookies_; | 222 return block_third_party_cookies_; |
| 222 } | 223 } |
| OLD | NEW |