| 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/pref_service.h" | 10 #include "chrome/browser/pref_service.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // static | 87 // static |
| 88 const wchar_t* | 88 const wchar_t* |
| 89 HostContentSettingsMap::kTypeNames[CONTENT_SETTINGS_NUM_TYPES] = { | 89 HostContentSettingsMap::kTypeNames[CONTENT_SETTINGS_NUM_TYPES] = { |
| 90 L"cookies", | 90 L"cookies", |
| 91 L"images", | 91 L"images", |
| 92 L"javascript", | 92 L"javascript", |
| 93 L"plugins", | 93 L"plugins", |
| 94 L"popups", | 94 L"popups", |
| 95 NULL, // Not used for Geolocation | 95 NULL, // Not used for Geolocation |
| 96 NULL, // Not used for Notifications |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 // static | 99 // static |
| 99 const ContentSetting | 100 const ContentSetting |
| 100 HostContentSettingsMap::kDefaultSettings[CONTENT_SETTINGS_NUM_TYPES] = { | 101 HostContentSettingsMap::kDefaultSettings[CONTENT_SETTINGS_NUM_TYPES] = { |
| 101 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES | 102 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_COOKIES |
| 102 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES | 103 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_IMAGES |
| 103 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT | 104 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT |
| 104 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS | 105 CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
| 105 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS | 106 CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
| 106 CONTENT_SETTING_ASK, // Not used for Geolocation | 107 CONTENT_SETTING_ASK, // Not used for Geolocation |
| 108 CONTENT_SETTING_ASK, // Not used for Notifications |
| 107 }; | 109 }; |
| 108 | 110 |
| 109 HostContentSettingsMap::HostContentSettingsMap(Profile* profile) | 111 HostContentSettingsMap::HostContentSettingsMap(Profile* profile) |
| 110 : profile_(profile), | 112 : profile_(profile), |
| 111 block_third_party_cookies_(false), | 113 block_third_party_cookies_(false), |
| 112 is_off_the_record_(profile_->IsOffTheRecord()), | 114 is_off_the_record_(profile_->IsOffTheRecord()), |
| 113 updating_preferences_(false) { | 115 updating_preferences_(false) { |
| 114 PrefService* prefs = profile_->GetPrefs(); | 116 PrefService* prefs = profile_->GetPrefs(); |
| 115 | 117 |
| 116 // Migrate obsolete cookie pref. | 118 // Migrate obsolete cookie pref. |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 if (!profile_) | 640 if (!profile_) |
| 639 return; | 641 return; |
| 640 PrefService* prefs = profile_->GetPrefs(); | 642 PrefService* prefs = profile_->GetPrefs(); |
| 641 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); | 643 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); |
| 642 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); | 644 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); |
| 643 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); | 645 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); |
| 644 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, | 646 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, |
| 645 Source<Profile>(profile_)); | 647 Source<Profile>(profile_)); |
| 646 profile_ = NULL; | 648 profile_ = NULL; |
| 647 } | 649 } |
| OLD | NEW |