| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/plugins/flash_permission_context.h" | 5 #include "chrome/browser/plugins/flash_permission_context.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 8 #include "chrome/browser/permissions/permission_request_id.h" | 8 #include "chrome/browser/permissions/permission_request_id.h" |
| 9 #include "chrome/browser/plugins/plugin_utils.h" | 9 #include "chrome/browser/plugins/plugin_utils.h" |
| 10 #include "chrome/browser/plugins/plugins_field_trial.h" | 10 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 11 #include "components/content_settings/core/browser/host_content_settings_map.h" | 11 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 12 #include "components/content_settings/core/common/content_settings_pattern.h" | 12 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "url/origin.h" |
| 16 | 17 |
| 17 FlashPermissionContext::FlashPermissionContext(Profile* profile) | 18 FlashPermissionContext::FlashPermissionContext(Profile* profile) |
| 18 : PermissionContextBase(profile, | 19 : PermissionContextBase(profile, |
| 19 content::PermissionType::FLASH, | 20 content::PermissionType::FLASH, |
| 20 CONTENT_SETTINGS_TYPE_PLUGINS) {} | 21 CONTENT_SETTINGS_TYPE_PLUGINS) {} |
| 21 | 22 |
| 22 FlashPermissionContext::~FlashPermissionContext() {} | 23 FlashPermissionContext::~FlashPermissionContext() {} |
| 23 | 24 |
| 24 ContentSetting FlashPermissionContext::GetPermissionStatus( | 25 ContentSetting FlashPermissionContext::GetPermissionStatus( |
| 25 const GURL& requesting_origin, | 26 const GURL& requesting_origin, |
| 26 const GURL& embedding_origin) const { | 27 const GURL& embedding_origin) const { |
| 27 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( | 28 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( |
| 28 HostContentSettingsMapFactory::GetForProfile(profile()), embedding_origin, | 29 HostContentSettingsMapFactory::GetForProfile(profile()), |
| 29 requesting_origin, nullptr); | 30 url::Origin(embedding_origin), requesting_origin, nullptr); |
| 30 flash_setting = PluginsFieldTrial::EffectiveContentSetting( | 31 flash_setting = PluginsFieldTrial::EffectiveContentSetting( |
| 31 CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); | 32 CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); |
| 32 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) | 33 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) |
| 33 return CONTENT_SETTING_ASK; | 34 return CONTENT_SETTING_ASK; |
| 34 return flash_setting; | 35 return flash_setting; |
| 35 } | 36 } |
| 36 | 37 |
| 37 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, | 38 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, |
| 38 const GURL& requesting_origin, | 39 const GURL& requesting_origin, |
| 39 bool allowed) { | 40 bool allowed) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 HostContentSettingsMapFactory::GetForProfile(profile()) | 67 HostContentSettingsMapFactory::GetForProfile(profile()) |
| 67 ->SetContentSettingCustomScope( | 68 ->SetContentSettingCustomScope( |
| 68 pattern, ContentSettingsPattern::Wildcard(), content_settings_type(), | 69 pattern, ContentSettingsPattern::Wildcard(), content_settings_type(), |
| 69 std::string(), content_setting); | 70 std::string(), content_setting); |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { | 73 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { |
| 73 return false; | 74 return false; |
| 74 } | 75 } |
| OLD | NEW |