| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 151 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
| 152 RendererContentSettingRules* rules) { | 152 RendererContentSettingRules* rules) { |
| 153 #if !defined(OS_ANDROID) | 153 #if !defined(OS_ANDROID) |
| 154 map->GetSettingsForOneType( | 154 map->GetSettingsForOneType( |
| 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(ContentSettingPatternSource( |
| 162 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), | 162 ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), |
| 163 ContentSettingsPattern::Wildcard(), | 163 CONTENT_SETTING_ALLOW, base::Time(), std::string(), map->is_incognito())); |
| 164 CONTENT_SETTING_ALLOW, | |
| 165 std::string(), | |
| 166 map->is_incognito())); | |
| 167 #endif | 164 #endif |
| 168 map->GetSettingsForOneType( | 165 map->GetSettingsForOneType( |
| 169 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 166 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 170 ResourceIdentifier(), | 167 ResourceIdentifier(), |
| 171 &(rules->script_rules)); | 168 &(rules->script_rules)); |
| 172 map->GetSettingsForOneType( | 169 map->GetSettingsForOneType( |
| 173 CONTENT_SETTINGS_TYPE_AUTOPLAY, | 170 CONTENT_SETTINGS_TYPE_AUTOPLAY, |
| 174 ResourceIdentifier(), | 171 ResourceIdentifier(), |
| 175 &(rules->autoplay_rules)); | 172 &(rules->autoplay_rules)); |
| 176 } | 173 } |
| 177 | 174 |
| 178 bool IsMorePermissive(ContentSetting a, ContentSetting b) { | 175 bool IsMorePermissive(ContentSetting a, ContentSetting b) { |
| 179 // Check whether |a| or |b| is reached first in kContentSettingOrder. | 176 // Check whether |a| or |b| is reached first in kContentSettingOrder. |
| 180 // If |a| is first, it means that |a| is more permissive than |b|. | 177 // If |a| is first, it means that |a| is more permissive than |b|. |
| 181 for (ContentSetting setting : kContentSettingOrder) { | 178 for (ContentSetting setting : kContentSettingOrder) { |
| 182 if (setting == b) | 179 if (setting == b) |
| 183 return false; | 180 return false; |
| 184 if (setting == a) | 181 if (setting == a) |
| 185 return true; | 182 return true; |
| 186 } | 183 } |
| 187 NOTREACHED(); | 184 NOTREACHED(); |
| 188 return true; | 185 return true; |
| 189 } | 186 } |
| 190 | 187 |
| 191 } // namespace content_settings | 188 } // namespace content_settings |
| OLD | NEW |