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

Unified Diff: chrome/browser/host_content_settings_map.cc

Issue 556095: Changes to support new cookie policy.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/host_content_settings_map.h ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/host_content_settings_map.cc
===================================================================
--- chrome/browser/host_content_settings_map.cc (revision 37613)
+++ chrome/browser/host_content_settings_map.cc (working copy)
@@ -20,7 +20,8 @@
};
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 @@
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 @@
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 @@
profile_->GetPrefs()->ClearPref(prefs::kDefaultContentSettings);
profile_->GetPrefs()->ClearPref(prefs::kPerHostContentSettings);
+
+ // TODO(darin): clear third-party cookie pref
}
HostContentSettingsMap::~HostContentSettingsMap() {
« no previous file with comments | « chrome/browser/host_content_settings_map.h ('k') | chrome/browser/net/chrome_url_request_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698