| 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" |
| 11 #include "chrome/browser/profiles/incognito_helpers.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_dependency_manager.h" | 13 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 13 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/content_settings_pattern.h" | 17 #include "chrome/common/content_settings_pattern.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "components/user_prefs/pref_registry_syncable.h" | 19 #include "components/user_prefs/pref_registry_syncable.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 66 |
| 66 CookieSettings::Factory::~Factory() {} | 67 CookieSettings::Factory::~Factory() {} |
| 67 | 68 |
| 68 void CookieSettings::Factory::RegisterUserPrefs( | 69 void CookieSettings::Factory::RegisterUserPrefs( |
| 69 PrefRegistrySyncable* registry) { | 70 PrefRegistrySyncable* registry) { |
| 70 registry->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, | 71 registry->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, |
| 71 false, | 72 false, |
| 72 PrefRegistrySyncable::SYNCABLE_PREF); | 73 PrefRegistrySyncable::SYNCABLE_PREF); |
| 73 } | 74 } |
| 74 | 75 |
| 75 bool CookieSettings::Factory::ServiceRedirectedInIncognito() const { | 76 content::BrowserContext* CookieSettings::Factory::GetBrowserContextToUse( |
| 76 return true; | 77 content::BrowserContext* context) const { |
| 78 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 77 } | 79 } |
| 78 | 80 |
| 79 scoped_refptr<RefcountedProfileKeyedService> | 81 scoped_refptr<RefcountedProfileKeyedService> |
| 80 CookieSettings::Factory::BuildServiceInstanceFor( | 82 CookieSettings::Factory::BuildServiceInstanceFor( |
| 81 content::BrowserContext* context) const { | 83 content::BrowserContext* context) const { |
| 82 Profile* profile = static_cast<Profile*>(context); | 84 Profile* profile = static_cast<Profile*>(context); |
| 83 return new CookieSettings(profile->GetHostContentSettingsMap(), | 85 return new CookieSettings(profile->GetHostContentSettingsMap(), |
| 84 profile->GetPrefs()); | 86 profile->GetPrefs()); |
| 85 } | 87 } |
| 86 | 88 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 226 |
| 225 base::AutoLock auto_lock(lock_); | 227 base::AutoLock auto_lock(lock_); |
| 226 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( | 228 block_third_party_cookies_ = pref_change_registrar_.prefs()->GetBoolean( |
| 227 prefs::kBlockThirdPartyCookies); | 229 prefs::kBlockThirdPartyCookies); |
| 228 } | 230 } |
| 229 | 231 |
| 230 bool CookieSettings::ShouldBlockThirdPartyCookies() const { | 232 bool CookieSettings::ShouldBlockThirdPartyCookies() const { |
| 231 base::AutoLock auto_lock(lock_); | 233 base::AutoLock auto_lock(lock_); |
| 232 return block_third_party_cookies_; | 234 return block_third_party_cookies_; |
| 233 } | 235 } |
| OLD | NEW |