| 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/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 if ((kTypeNames[type] != NULL) && (kTypeNames[type] == content_type)) { | 797 if ((kTypeNames[type] != NULL) && (kTypeNames[type] == content_type)) { |
| 798 int setting = CONTENT_SETTING_DEFAULT; | 798 int setting = CONTENT_SETTING_DEFAULT; |
| 799 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, | 799 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, |
| 800 &setting); | 800 &setting); |
| 801 DCHECK(found); | 801 DCHECK(found); |
| 802 settings->settings[type] = IntToContentSetting(setting); | 802 settings->settings[type] = IntToContentSetting(setting); |
| 803 break; | 803 break; |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 807 // Migrate obsolete cookie prompt mode. |
| 808 switches::kEnableCookiePrompt)) { | 808 if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] == |
| 809 // Migrate obsolete cookie prompt mode. | 809 CONTENT_SETTING_ASK) |
| 810 if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] == | 810 settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK; |
| 811 CONTENT_SETTING_ASK) | |
| 812 settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK; | |
| 813 } | |
| 814 } | 811 } |
| 815 | 812 |
| 816 void HostContentSettingsMap::GetResourceSettingsFromDictionary( | 813 void HostContentSettingsMap::GetResourceSettingsFromDictionary( |
| 817 const DictionaryValue* dictionary, | 814 const DictionaryValue* dictionary, |
| 818 ResourceContentSettings* settings) { | 815 ResourceContentSettings* settings) { |
| 819 for (DictionaryValue::key_iterator i(dictionary->begin_keys()); | 816 for (DictionaryValue::key_iterator i(dictionary->begin_keys()); |
| 820 i != dictionary->end_keys(); ++i) { | 817 i != dictionary->end_keys(); ++i) { |
| 821 const std::string& content_type(*i); | 818 const std::string& content_type(*i); |
| 822 for (size_t type = 0; type < arraysize(kResourceTypeNames); ++type) { | 819 for (size_t type = 0; type < arraysize(kResourceTypeNames); ++type) { |
| 823 if ((kResourceTypeNames[type] != NULL) && | 820 if ((kResourceTypeNames[type] != NULL) && |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 return; | 915 return; |
| 919 PrefService* prefs = profile_->GetPrefs(); | 916 PrefService* prefs = profile_->GetPrefs(); |
| 920 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); | 917 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); |
| 921 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); | 918 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); |
| 922 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); | 919 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); |
| 923 prefs->RemovePrefObserver(prefs::kBlockNonsandboxedPlugins, this); | 920 prefs->RemovePrefObserver(prefs::kBlockNonsandboxedPlugins, this); |
| 924 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, | 921 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, |
| 925 Source<Profile>(profile_)); | 922 Source<Profile>(profile_)); |
| 926 profile_ = NULL; | 923 profile_ = NULL; |
| 927 } | 924 } |
| OLD | NEW |