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/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" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 ContentSetting setting) { | 80 ContentSetting setting) { |
81 if (setting == CONTENT_SETTING_ASK && | 81 if (setting == CONTENT_SETTING_ASK && |
82 content_type == CONTENT_SETTINGS_TYPE_PLUGINS && | 82 content_type == CONTENT_SETTINGS_TYPE_PLUGINS && |
83 !CommandLine::ForCurrentProcess()->HasSwitch( | 83 !CommandLine::ForCurrentProcess()->HasSwitch( |
84 switches::kEnableClickToPlay)) { | 84 switches::kEnableClickToPlay)) { |
85 return CONTENT_SETTING_BLOCK; | 85 return CONTENT_SETTING_BLOCK; |
86 } | 86 } |
87 return setting; | 87 return setting; |
88 } | 88 } |
89 | 89 |
90 typedef std::vector<linked_ptr<ContentSettingsProviderInterface> >::iterator | |
91 provider_iterator; | |
92 typedef | 90 typedef |
93 std::vector<linked_ptr<ContentSettingsProviderInterface> >::const_iterator | 91 std::vector<linked_ptr<DefaultContentSettingsProviderInterface> >::iterator |
94 const_provider_iterator; | 92 provider_iterator; |
93 typedef | |
94 std::vector | |
95 <linked_ptr<DefaultContentSettingsProviderInterface> >::const_iterator | |
96 const_provider_iterator; | |
Bernhard Bauer
2011/01/25 13:11:19
I guess you could pull out some more typedefs (ptr
markusheintz_
2011/01/25 13:57:43
done.
| |
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<DefaultContentSettingsProviderInterface>( |
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<DefaultContentSettingsProviderInterface>( |
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 |