OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/host_content_settings_map.h" | 5 #include "chrome/browser/host_content_settings_map.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 void HostContentSettingsMap::ResetToDefaults() { | 792 void HostContentSettingsMap::ResetToDefaults() { |
793 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 793 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
794 | 794 |
795 { | 795 { |
796 AutoLock auto_lock(lock_); | 796 AutoLock auto_lock(lock_); |
797 default_content_settings_ = ContentSettings(); | 797 default_content_settings_ = ContentSettings(); |
798 ForceDefaultsToBeExplicit(); | 798 ForceDefaultsToBeExplicit(); |
799 // Clear all content settings map except the | |
800 // managed_default_content_settings. | |
799 host_content_settings_.clear(); | 801 host_content_settings_.clear(); |
800 off_the_record_settings_.clear(); | 802 off_the_record_settings_.clear(); |
801 block_third_party_cookies_ = false; | 803 // Don't reset block third party cookies if they are managed. |
804 if (!IsBlockThirdPartyCookiesManaged()) | |
805 block_third_party_cookies_ = false; | |
802 block_nonsandboxed_plugins_ = false; | 806 block_nonsandboxed_plugins_ = false; |
803 } | 807 } |
804 | 808 |
805 if (!is_off_the_record_) { | 809 if (!is_off_the_record_) { |
806 PrefService* prefs = profile_->GetPrefs(); | 810 PrefService* prefs = profile_->GetPrefs(); |
807 updating_preferences_ = true; | 811 updating_preferences_ = true; |
808 prefs->ClearPref(prefs::kDefaultContentSettings); | 812 prefs->ClearPref(prefs::kDefaultContentSettings); |
809 prefs->ClearPref(prefs::kContentSettingsPatterns); | 813 prefs->ClearPref(prefs::kContentSettingsPatterns); |
814 // If the block third party cookies preference is managed we still must | |
815 // clear it in order to restore the default value for later when the | |
816 // preference is not managaged anymore. | |
jochen (gone - plz use gerrit)
2010/11/29 13:31:28
managed
markusheintz_
2010/11/29 13:58:02
Done.
| |
810 prefs->ClearPref(prefs::kBlockThirdPartyCookies); | 817 prefs->ClearPref(prefs::kBlockThirdPartyCookies); |
811 prefs->ClearPref(prefs::kBlockNonsandboxedPlugins); | 818 prefs->ClearPref(prefs::kBlockNonsandboxedPlugins); |
812 updating_preferences_ = false; | 819 updating_preferences_ = false; |
813 NotifyObservers( | 820 NotifyObservers( |
814 ContentSettingsDetails(Pattern(), CONTENT_SETTINGS_TYPE_DEFAULT, "")); | 821 ContentSettingsDetails(Pattern(), CONTENT_SETTINGS_TYPE_DEFAULT, "")); |
815 } | 822 } |
816 } | 823 } |
817 | 824 |
818 void HostContentSettingsMap::Observe(NotificationType type, | 825 void HostContentSettingsMap::Observe(NotificationType type, |
819 const NotificationSource& source, | 826 const NotificationSource& source, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 } | 1161 } |
1155 | 1162 |
1156 for (size_t i = 0; i < move_items.size(); ++i) { | 1163 for (size_t i = 0; i < move_items.size(); ++i) { |
1157 Value* pattern_settings_dictionary = NULL; | 1164 Value* pattern_settings_dictionary = NULL; |
1158 all_settings_dictionary->RemoveWithoutPathExpansion( | 1165 all_settings_dictionary->RemoveWithoutPathExpansion( |
1159 move_items[i].first, &pattern_settings_dictionary); | 1166 move_items[i].first, &pattern_settings_dictionary); |
1160 all_settings_dictionary->SetWithoutPathExpansion( | 1167 all_settings_dictionary->SetWithoutPathExpansion( |
1161 move_items[i].second, pattern_settings_dictionary); | 1168 move_items[i].second, pattern_settings_dictionary); |
1162 } | 1169 } |
1163 } | 1170 } |
OLD | NEW |