summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_content_settings_map.cc
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:29:17 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 15:29:17 +0000
commitbd14784bcadf8cf55ae92e713a2545245bb02826 (patch)
tree7cf74d7dfa33e0dd46f4c0b0e32d788f53143e29 /chrome/browser/host_content_settings_map.cc
parent94d2c4067766e532bfd7b61a9b7f0a0616325642 (diff)
downloadchromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.zip
chromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.tar.gz
chromium_src-bd14784bcadf8cf55ae92e713a2545245bb02826.tar.bz2
Disable remember option in cookie prompt and content blocked notification bubbles when running OTR.
BUG=37525 TEST=Manual, check cookie prompt and bubbles in OTR session Review URL: http://codereview.chromium.org/1629011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_content_settings_map.cc')
-rw-r--r--chrome/browser/host_content_settings_map.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index fd7517a..378dfad 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -102,7 +102,8 @@ const ContentSetting
HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
: profile_(profile),
- block_third_party_cookies_(false) {
+ block_third_party_cookies_(false),
+ is_off_the_record_(profile_->IsOffTheRecord()) {
PrefService* prefs = profile_->GetPrefs();
// Migrate obsolete cookie pref.
@@ -296,6 +297,12 @@ void HostContentSettingsMap::SetDefaultContentSetting(
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
DictionaryValue* default_settings_dictionary =
profile_->GetPrefs()->GetMutableDictionary(
prefs::kDefaultContentSettings);
@@ -324,6 +331,12 @@ void HostContentSettingsMap::SetContentSetting(const Pattern& pattern,
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
bool early_exit = false;
std::wstring wide_pattern(UTF8ToWide(pattern.AsString()));
DictionaryValue* all_settings_dictionary =
@@ -373,6 +386,13 @@ void HostContentSettingsMap::SetContentSetting(const Pattern& pattern,
void HostContentSettingsMap::ClearSettingsForOneType(
ContentSettingsType content_type) {
DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
+
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
{
AutoLock auto_lock(lock_);
for (HostContentSettings::iterator i(host_content_settings_.begin());
@@ -408,6 +428,12 @@ void HostContentSettingsMap::ClearSettingsForOneType(
void HostContentSettingsMap::SetBlockThirdPartyCookies(bool block) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ // Settings may not be modified for OTR sessions.
+ if (is_off_the_record_) {
+ NOTREACHED();
+ return;
+ }
+
{
AutoLock auto_lock(lock_);
block_third_party_cookies_ = block;
@@ -439,6 +465,10 @@ void HostContentSettingsMap::ResetToDefaults() {
NotifyObservers(ContentSettingsDetails(true));
}
+bool HostContentSettingsMap::IsOffTheRecord() {
+ return profile_->IsOffTheRecord();
+}
+
HostContentSettingsMap::~HostContentSettingsMap() {
}