Chromium Code Reviews| Index: chrome/browser/plugins/flash_permission_context.cc |
| diff --git a/chrome/browser/plugins/flash_permission_context.cc b/chrome/browser/plugins/flash_permission_context.cc |
| index f70d341637b8a341a4e1a1384f787a966ecdc1eb..b29ae20e72e259be3917f1e496fc719c254127ab 100644 |
| --- a/chrome/browser/plugins/flash_permission_context.cc |
| +++ b/chrome/browser/plugins/flash_permission_context.cc |
| @@ -4,6 +4,15 @@ |
| #include "chrome/browser/plugins/flash_permission_context.h" |
| +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| +#include "chrome/browser/infobars/infobar_service.h" |
| +#include "chrome/browser/permissions/permission_request_id.h" |
| +#include "chrome/browser/plugins/plugin_utils.h" |
| +#include "chrome/browser/plugins/plugins_field_trial.h" |
| +#include "chrome/browser/ui/website_settings/website_settings_infobar_delegate.h" |
| +#include "components/content_settings/core/browser/host_content_settings_map.h" |
| +#include "content/public/browser/render_frame_host.h" |
| + |
| FlashPermissionContext::FlashPermissionContext(Profile* profile) |
| : PermissionContextBase(profile, |
| content::PermissionType::FLASH, |
| @@ -11,6 +20,34 @@ FlashPermissionContext::FlashPermissionContext(Profile* profile) |
| FlashPermissionContext::~FlashPermissionContext() {} |
| +ContentSetting FlashPermissionContext::GetPermissionStatus( |
| + const GURL& requesting_origin, |
| + const GURL& embedding_origin) const { |
| + ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( |
| + HostContentSettingsMapFactory::GetForProfile(profile()), embedding_origin, |
| + requesting_origin); |
| + flash_setting = PluginsFieldTrial::EffectiveContentSetting( |
| + CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting); |
| + if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) |
| + return CONTENT_SETTING_ASK; |
| + return flash_setting; |
| +} |
| + |
| +void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, |
| + const GURL& requesting_origin, |
| + bool allowed) { |
| + if (allowed) { |
|
Bernhard Bauer
2016/09/22 16:59:10
Return early if not allowed?
raymes
2016/09/26 03:23:33
Done.
|
| + content::WebContents* web_contents = |
| + content::WebContents::FromRenderFrameHost( |
| + content::RenderFrameHost::FromID(id.render_process_id(), |
| + id.render_frame_id())); |
| + InfoBarService* infobar_service = |
| + InfoBarService::FromWebContents(web_contents); |
| + if (infobar_service) |
| + WebsiteSettingsInfoBarDelegate::Create(infobar_service); |
| + } |
| +} |
| + |
| bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { |
| return false; |
| } |