| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 std::unique_ptr<base::Value> ContentSettingToValue(ContentSetting setting) { | 126 std::unique_ptr<base::Value> ContentSettingToValue(ContentSetting setting) { |
| 127 if (setting <= CONTENT_SETTING_DEFAULT || | 127 if (setting <= CONTENT_SETTING_DEFAULT || |
| 128 setting >= CONTENT_SETTING_NUM_SETTINGS) { | 128 setting >= CONTENT_SETTING_NUM_SETTINGS) { |
| 129 return nullptr; | 129 return nullptr; |
| 130 } | 130 } |
| 131 return base::WrapUnique(new base::FundamentalValue(setting)); | 131 return base::WrapUnique(new base::FundamentalValue(setting)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void GetRendererContentSettingRules(const HostContentSettingsMap* map, | 134 void GetRendererContentSettingRules(const HostContentSettingsMap* map, |
| 135 RendererContentSettingRules* rules) { | 135 RendererContentSettingRules* rules) { |
| 136 #if !defined(OS_ANDROID) |
| 136 map->GetSettingsForOneType( | 137 map->GetSettingsForOneType( |
| 137 CONTENT_SETTINGS_TYPE_IMAGES, | 138 CONTENT_SETTINGS_TYPE_IMAGES, |
| 138 ResourceIdentifier(), | 139 ResourceIdentifier(), |
| 139 &(rules->image_rules)); | 140 &(rules->image_rules)); |
| 141 #else |
| 142 // Android doesn't use image content settings, so ALLOW rule is added for |
| 143 // all origins. |
| 144 rules->image_rules.push_back( |
| 145 ContentSettingPatternSource(ContentSettingsPattern::Wildcard(), |
| 146 ContentSettingsPattern::Wildcard(), |
| 147 CONTENT_SETTING_ALLOW, |
| 148 std::string(), |
| 149 map->is_off_the_record())); |
| 150 #endif |
| 140 map->GetSettingsForOneType( | 151 map->GetSettingsForOneType( |
| 141 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 152 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 142 ResourceIdentifier(), | 153 ResourceIdentifier(), |
| 143 &(rules->script_rules)); | 154 &(rules->script_rules)); |
| 144 map->GetSettingsForOneType( | 155 map->GetSettingsForOneType( |
| 145 CONTENT_SETTINGS_TYPE_AUTOPLAY, | 156 CONTENT_SETTINGS_TYPE_AUTOPLAY, |
| 146 ResourceIdentifier(), | 157 ResourceIdentifier(), |
| 147 &(rules->autoplay_rules)); | 158 &(rules->autoplay_rules)); |
| 148 } | 159 } |
| 149 | 160 |
| 150 } // namespace content_settings | 161 } // namespace content_settings |
| OLD | NEW |