| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/content_settings/core/browser/content_settings_utils.h" | 5 #include "components/content_settings/core/browser/content_settings_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 CONTENT_SETTINGS_TYPE_IMAGES, | 155 CONTENT_SETTINGS_TYPE_IMAGES, |
| 156 ResourceIdentifier(), | 156 ResourceIdentifier(), |
| 157 &(rules->image_rules)); | 157 &(rules->image_rules)); |
| 158 #else | 158 #else |
| 159 // Android doesn't use image content settings, so ALLOW rule is added for | 159 // Android doesn't use image content settings, so ALLOW rule is added for |
| 160 // all origins. | 160 // all origins. |
| 161 rules->image_rules.push_back( | 161 rules->image_rules.push_back( |
| 162 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 162 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 163 ContentSettingsPattern::Wildcard(), | 163 ContentSettingsPattern::Wildcard(), |
| 164 CONTENT_SETTING_ALLOW, | 164 CONTENT_SETTING_ALLOW, |
| 165 base::Time(), |
| 165 std::string(), | 166 std::string(), |
| 166 map->is_incognito())); | 167 map->is_incognito())); |
| 167 #endif | 168 #endif |
| 168 map->GetSettingsForOneType( | 169 map->GetSettingsForOneType( |
| 169 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 170 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 170 ResourceIdentifier(), | 171 ResourceIdentifier(), |
| 171 &(rules->script_rules)); | 172 &(rules->script_rules)); |
| 172 map->GetSettingsForOneType( | 173 map->GetSettingsForOneType( |
| 173 CONTENT_SETTINGS_TYPE_AUTOPLAY, | 174 CONTENT_SETTINGS_TYPE_AUTOPLAY, |
| 174 ResourceIdentifier(), | 175 ResourceIdentifier(), |
| 175 &(rules->autoplay_rules)); | 176 &(rules->autoplay_rules)); |
| 176 } | 177 } |
| 177 | 178 |
| 178 bool IsMorePermissive(ContentSetting a, ContentSetting b) { | 179 bool IsMorePermissive(ContentSetting a, ContentSetting b) { |
| 179 // Check whether |a| or |b| is reached first in kContentSettingOrder. | 180 // Check whether |a| or |b| is reached first in kContentSettingOrder. |
| 180 // If |a| is first, it means that |a| is more permissive than |b|. | 181 // If |a| is first, it means that |a| is more permissive than |b|. |
| 181 for (ContentSetting setting : kContentSettingOrder) { | 182 for (ContentSetting setting : kContentSettingOrder) { |
| 182 if (setting == b) | 183 if (setting == b) |
| 183 return false; | 184 return false; |
| 184 if (setting == a) | 185 if (setting == a) |
| 185 return true; | 186 return true; |
| 186 } | 187 } |
| 187 NOTREACHED(); | 188 NOTREACHED(); |
| 188 return true; | 189 return true; |
| 189 } | 190 } |
| 190 | 191 |
| 191 } // namespace content_settings | 192 } // namespace content_settings |
| OLD | NEW |