summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_content_settings_map.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 08:24:12 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-30 08:24:12 +0000
commitcb370a06391bd8cd1d3c52e4722645962366dd42 (patch)
tree9ca36ba10363365401bd1a816962f4679fda8467 /chrome/browser/host_content_settings_map.cc
parentdbefae2c2db09a90c2b9ee4d3ea1a40e580e532e (diff)
downloadchromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.zip
chromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.tar.gz
chromium_src-cb370a06391bd8cd1d3c52e4722645962366dd42.tar.bz2
Changes to support new cookie policy.
Changes: 1- net::CookiePolicy becomes an interface. 2- Old implementaiton of CookiePolicy copied to StaticCookiePolicy. 3- ChromeULRRequestContext implements CookiePolicy. 4- HostContentSettingsMap gets a global "BlockThirdPartyCookies" pref. R=pkasting Review URL: http://codereview.chromium.org/556095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_content_settings_map.cc')
-rw-r--r--chrome/browser/host_content_settings_map.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index 602b35c..de3aca4 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -20,7 +20,8 @@ const wchar_t* HostContentSettingsMap::kTypeNames[] = {
};
HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
- : profile_(profile) {
+ : profile_(profile),
+ block_third_party_cookies_(false) {
DCHECK_EQ(arraysize(kTypeNames),
static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES));
@@ -48,12 +49,16 @@ HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
host_content_settings_[WideToUTF8(wide_host)] = settings;
}
}
+
+ // TODO(darin): init third-party cookie pref
}
// static
void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings);
prefs->RegisterDictionaryPref(prefs::kPerHostContentSettings);
+
+ // TODO(darin): register third-party cookie pref
}
ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
@@ -68,14 +73,26 @@ ContentSetting HostContentSettingsMap::GetContentSetting(
AutoLock auto_lock(lock_);
HostContentSettings::const_iterator i(host_content_settings_.find(host));
return (i == host_content_settings_.end()) ?
- CONTENT_SETTING_DEFAULT : i->second.settings[content_type];
+ default_content_settings_.settings[content_type] :
+ i->second.settings[content_type];
}
ContentSettings HostContentSettingsMap::GetContentSettings(
const std::string& host) const {
AutoLock auto_lock(lock_);
HostContentSettings::const_iterator i(host_content_settings_.find(host));
- return (i == host_content_settings_.end()) ? ContentSettings() : i->second;
+ if (i == host_content_settings_.end())
+ return default_content_settings_;
+
+ ContentSettings output;
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ if (i->second.settings[i] == CONTENT_SETTING_DEFAULT) {
+ output.settings[i] = default_content_settings_.settings[i];
+ } else {
+ output.settings[i] = i->second.settings[i];
+ }
+ }
+ return output;
}
void HostContentSettingsMap::GetHostContentSettingsForOneType(
@@ -163,6 +180,8 @@ void HostContentSettingsMap::ResetToDefaults() {
profile_->GetPrefs()->ClearPref(prefs::kDefaultContentSettings);
profile_->GetPrefs()->ClearPref(prefs::kPerHostContentSettings);
+
+ // TODO(darin): clear third-party cookie pref
}
HostContentSettingsMap::~HostContentSettingsMap() {