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/flash_temporary_permission_tracker.h" | 9 #include "chrome/browser/plugins/flash_temporary_permission_tracker.h" |
10 #include "chrome/browser/plugins/plugin_utils.h" | 10 #include "chrome/browser/plugins/plugin_utils.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 FlashPermissionContext::FlashPermissionContext(Profile* profile) | 33 FlashPermissionContext::FlashPermissionContext(Profile* profile) |
34 : PermissionContextBase(profile, | 34 : PermissionContextBase(profile, |
35 CONTENT_SETTINGS_TYPE_PLUGINS, | 35 CONTENT_SETTINGS_TYPE_PLUGINS, |
36 blink::WebFeaturePolicyFeature::kNotFound) {} | 36 blink::WebFeaturePolicyFeature::kNotFound) {} |
37 | 37 |
38 FlashPermissionContext::~FlashPermissionContext() {} | 38 FlashPermissionContext::~FlashPermissionContext() {} |
39 | 39 |
40 ContentSetting FlashPermissionContext::GetPermissionStatusInternal( | 40 PermissionResult FlashPermissionContext::GetPermissionStatusInternal( |
41 content::RenderFrameHost* render_frame_host, | 41 content::RenderFrameHost* render_frame_host, |
42 const GURL& requesting_origin, | 42 const GURL& requesting_origin, |
43 const GURL& embedding_origin) const { | 43 const GURL& embedding_origin) const { |
44 HostContentSettingsMap* host_content_settings_map = | 44 HostContentSettingsMap* host_content_settings_map = |
45 HostContentSettingsMapFactory::GetForProfile(profile()); | 45 HostContentSettingsMapFactory::GetForProfile(profile()); |
46 ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting( | 46 PermissionResult flash_result = PluginUtils::GetFlashPluginContentSetting( |
47 host_content_settings_map, url::Origin(embedding_origin), | 47 host_content_settings_map, url::Origin(embedding_origin), |
48 requesting_origin, nullptr); | 48 requesting_origin, nullptr); |
49 flash_setting = PluginsFieldTrial::EffectiveContentSetting( | 49 flash_result.content_setting = PluginsFieldTrial::EffectiveContentSetting( |
50 host_content_settings_map, content_settings_type(), flash_setting); | 50 host_content_settings_map, content_settings_type(), |
51 if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) | 51 flash_result.content_setting); |
52 return CONTENT_SETTING_ASK; | 52 if (flash_result.content_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) |
53 return flash_setting; | 53 flash_result.content_setting = CONTENT_SETTING_ASK; |
| 54 return flash_result; |
54 } | 55 } |
55 | 56 |
56 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, | 57 void FlashPermissionContext::UpdateTabContext(const PermissionRequestID& id, |
57 const GURL& requesting_origin, | 58 const GURL& requesting_origin, |
58 bool allowed) { | 59 bool allowed) { |
59 if (!allowed) | 60 if (!allowed) |
60 return; | 61 return; |
61 | 62 |
62 content::WebContents* web_contents = | 63 content::WebContents* web_contents = |
63 content::WebContents::FromRenderFrameHost( | 64 content::WebContents::FromRenderFrameHost( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 else | 99 else |
99 pattern = ContentSettingsPattern::FromURLNoWildcard(embedding_origin); | 100 pattern = ContentSettingsPattern::FromURLNoWildcard(embedding_origin); |
100 host_content_settings_map->SetContentSettingCustomScope( | 101 host_content_settings_map->SetContentSettingCustomScope( |
101 pattern, ContentSettingsPattern::Wildcard(), content_settings_type(), | 102 pattern, ContentSettingsPattern::Wildcard(), content_settings_type(), |
102 std::string(), content_setting); | 103 std::string(), content_setting); |
103 } | 104 } |
104 | 105 |
105 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { | 106 bool FlashPermissionContext::IsRestrictedToSecureOrigins() const { |
106 return false; | 107 return false; |
107 } | 108 } |
OLD | NEW |