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

Side by Side Diff: chrome/browser/content_settings/cookie_settings.cc

Issue 900803002: Introduce a CookieSettings for incognito mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/cookie_settings_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/content_settings/cookie_settings.h" 5 #include "chrome/browser/content_settings/cookie_settings.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/incognito_helpers.h" 9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void CookieSettings::Factory::RegisterProfilePrefs( 67 void CookieSettings::Factory::RegisterProfilePrefs(
68 user_prefs::PrefRegistrySyncable* registry) { 68 user_prefs::PrefRegistrySyncable* registry) {
69 registry->RegisterBooleanPref( 69 registry->RegisterBooleanPref(
70 prefs::kBlockThirdPartyCookies, 70 prefs::kBlockThirdPartyCookies,
71 false, 71 false,
72 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 72 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
73 } 73 }
74 74
75 content::BrowserContext* CookieSettings::Factory::GetBrowserContextToUse( 75 content::BrowserContext* CookieSettings::Factory::GetBrowserContextToUse(
76 content::BrowserContext* context) const { 76 content::BrowserContext* context) const {
77 return chrome::GetBrowserContextRedirectedInIncognito(context); 77 // The incognito profile has its own content settings map. Therefore, it
78 // should get its own CookieSettings.
79 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
78 } 80 }
79 81
80 scoped_refptr<RefcountedKeyedService> 82 scoped_refptr<RefcountedKeyedService>
81 CookieSettings::Factory::BuildServiceInstanceFor( 83 CookieSettings::Factory::BuildServiceInstanceFor(
82 content::BrowserContext* context) const { 84 content::BrowserContext* context) const {
83 Profile* profile = static_cast<Profile*>(context); 85 Profile* profile = static_cast<Profile*>(context);
84 return new CookieSettings(profile->GetHostContentSettingsMap(), 86 return new CookieSettings(profile->GetHostContentSettingsMap(),
85 profile->GetPrefs()); 87 profile->GetPrefs());
86 } 88 }
87 89
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/cookie_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698