Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/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" |
| 11 #include "chrome/browser/content_settings/content_settings_details.h" | 11 #include "chrome/browser/content_settings/content_settings_details.h" |
| 12 #include "chrome/browser/content_settings/content_settings_provider.h" | |
| 12 #include "chrome/browser/content_settings/policy_content_settings_provider.h" | 13 #include "chrome/browser/content_settings/policy_content_settings_provider.h" |
| 13 #include "chrome/browser/content_settings/pref_content_settings_provider.h" | 14 #include "chrome/browser/content_settings/pref_content_settings_provider.h" |
| 14 #include "chrome/browser/metrics/user_metrics.h" | 15 #include "chrome/browser/metrics/user_metrics.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/prefs/scoped_pref_update.h" | 18 #include "chrome/browser/prefs/scoped_pref_update.h" |
| 18 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
| 19 #include "chrome/common/notification_source.h" | 20 #include "chrome/common/notification_source.h" |
| 20 #include "chrome/common/notification_type.h" | 21 #include "chrome/common/notification_type.h" |
| 21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 ContentSetting setting) { | 81 ContentSetting setting) { |
| 81 if (setting == CONTENT_SETTING_ASK && | 82 if (setting == CONTENT_SETTING_ASK && |
| 82 content_type == CONTENT_SETTINGS_TYPE_PLUGINS && | 83 content_type == CONTENT_SETTINGS_TYPE_PLUGINS && |
| 83 !CommandLine::ForCurrentProcess()->HasSwitch( | 84 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 84 switches::kEnableClickToPlay)) { | 85 switches::kEnableClickToPlay)) { |
| 85 return CONTENT_SETTING_BLOCK; | 86 return CONTENT_SETTING_BLOCK; |
| 86 } | 87 } |
| 87 return setting; | 88 return setting; |
| 88 } | 89 } |
| 89 | 90 |
| 90 typedef std::vector<linked_ptr<ContentSettingsProviderInterface> >::iterator | 91 typedef linked_ptr<DefaultContentSettingsProvider> |
| 92 DefaultContentSettingsProviderPtr; | |
| 93 typedef std::vector<DefaultContentSettingsProviderPtr>::iterator | |
| 91 provider_iterator; | 94 provider_iterator; |
| 92 typedef | 95 typedef std::vector<DefaultContentSettingsProviderPtr>::const_iterator |
| 93 std::vector<linked_ptr<ContentSettingsProviderInterface> >::const_iterator | 96 const_provider_iterator; |
| 94 const_provider_iterator; | |
| 95 | 97 |
| 96 } // namespace | 98 } // namespace |
| 97 | 99 |
| 98 | 100 |
| 99 struct HostContentSettingsMap::ExtendedContentSettings { | 101 struct HostContentSettingsMap::ExtendedContentSettings { |
| 100 ContentSettings content_settings; | 102 ContentSettings content_settings; |
| 101 ResourceContentSettings content_settings_for_resources; | 103 ResourceContentSettings content_settings_for_resources; |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 HostContentSettingsMap::HostContentSettingsMap(Profile* profile) | 106 HostContentSettingsMap::HostContentSettingsMap(Profile* profile) |
| 105 : profile_(profile), | 107 : profile_(profile), |
| 106 is_off_the_record_(profile_->IsOffTheRecord()), | 108 is_off_the_record_(profile_->IsOffTheRecord()), |
| 107 updating_preferences_(false), | 109 updating_preferences_(false), |
| 108 block_third_party_cookies_(false), | 110 block_third_party_cookies_(false), |
| 109 is_block_third_party_cookies_managed_(false) { | 111 is_block_third_party_cookies_managed_(false) { |
| 110 // The order in which the content settings providers are created is critical, | 112 // The order in which the content settings providers are created is critical, |
| 111 // as providers that are further down in the list (i.e. added later) override | 113 // as providers that are further down in the list (i.e. added later) override |
| 112 // providers further up. | 114 // providers further up. |
| 113 content_settings_providers_.push_back( | 115 content_settings_providers_.push_back( |
| 114 linked_ptr<ContentSettingsProviderInterface>( | 116 linked_ptr<DefaultContentSettingsProvider>( |
|
jochen (gone - plz use gerrit)
2011/01/25 14:31:55
DefaultContentSettingsProviderPtr
markusheintz_
2011/01/25 14:46:22
Done.
| |
| 115 new PrefContentSettingsProvider(profile))); | 117 new PrefContentSettingsProvider(profile))); |
| 116 content_settings_providers_.push_back( | 118 content_settings_providers_.push_back( |
| 117 linked_ptr<ContentSettingsProviderInterface>( | 119 linked_ptr<DefaultContentSettingsProvider>( |
| 118 new PolicyContentSettingsProvider(profile))); | 120 new PolicyContentSettingsProvider(profile))); |
| 119 | 121 |
| 120 PrefService* prefs = profile_->GetPrefs(); | 122 PrefService* prefs = profile_->GetPrefs(); |
| 121 | 123 |
| 122 MigrateObsoleteCookiePref(prefs); | 124 MigrateObsoleteCookiePref(prefs); |
| 123 | 125 |
| 124 MigrateObsoletePopupsPref(prefs); | 126 MigrateObsoletePopupsPref(prefs); |
| 125 | 127 |
| 126 MigrateObsoletePerhostPref(prefs); | 128 MigrateObsoletePerhostPref(prefs); |
| 127 | 129 |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 } | 970 } |
| 969 | 971 |
| 970 for (size_t i = 0; i < move_items.size(); ++i) { | 972 for (size_t i = 0; i < move_items.size(); ++i) { |
| 971 Value* pattern_settings_dictionary = NULL; | 973 Value* pattern_settings_dictionary = NULL; |
| 972 all_settings_dictionary->RemoveWithoutPathExpansion( | 974 all_settings_dictionary->RemoveWithoutPathExpansion( |
| 973 move_items[i].first, &pattern_settings_dictionary); | 975 move_items[i].first, &pattern_settings_dictionary); |
| 974 all_settings_dictionary->SetWithoutPathExpansion( | 976 all_settings_dictionary->SetWithoutPathExpansion( |
| 975 move_items[i].second, pattern_settings_dictionary); | 977 move_items[i].second, pattern_settings_dictionary); |
| 976 } | 978 } |
| 977 } | 979 } |
| OLD | NEW |