Chromium Code Reviews| Index: chrome/browser/plugins/chrome_plugin_service_filter.cc |
| diff --git a/chrome/browser/plugins/chrome_plugin_service_filter.cc b/chrome/browser/plugins/chrome_plugin_service_filter.cc |
| index a7728e977ec1da8f97d8394beb5fc5d6d6a57773..3057563a1cd9e415b541a7e133ab864deb2777a8 100644 |
| --- a/chrome/browser/plugins/chrome_plugin_service_filter.cc |
| +++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| #include "chrome/browser/engagement/site_engagement_service.h" |
| +#include "chrome/browser/plugins/flash_temporary_permission_tracker.h" |
| #include "chrome/browser/plugins/plugin_finder.h" |
| #include "chrome/browser/plugins/plugin_metadata.h" |
| #include "chrome/browser/plugins/plugin_utils.h" |
| @@ -67,11 +68,13 @@ struct ChromePluginServiceFilter::ContextInfo { |
| ContextInfo( |
| const scoped_refptr<PluginPrefs>& plugin_prefs, |
|
Bernhard Bauer
2016/10/14 11:02:25
Oh, sorry, I also forgot to mention: Can you chang
raymes
2016/10/15 03:51:09
I think I've done what you asked, but let me know
|
| const scoped_refptr<HostContentSettingsMap>& host_content_settings_map, |
| + const scoped_refptr<FlashTemporaryPermissionTracker>& permission_tracker, |
| Profile* profile); |
| ~ContextInfo(); |
| scoped_refptr<PluginPrefs> plugin_prefs; |
| scoped_refptr<HostContentSettingsMap> host_content_settings_map; |
| + scoped_refptr<FlashTemporaryPermissionTracker> permission_tracker; |
| ProfileContentSettingObserver observer; |
| private: |
| @@ -81,9 +84,11 @@ struct ChromePluginServiceFilter::ContextInfo { |
| ChromePluginServiceFilter::ContextInfo::ContextInfo( |
| const scoped_refptr<PluginPrefs>& plugin_prefs, |
| const scoped_refptr<HostContentSettingsMap>& host_content_settings_map, |
| + const scoped_refptr<FlashTemporaryPermissionTracker>& permission_tracker, |
| Profile* profile) |
| : plugin_prefs(plugin_prefs), |
| host_content_settings_map(host_content_settings_map), |
| + permission_tracker(permission_tracker), |
| observer(ProfileContentSettingObserver(profile)) { |
|
Bernhard Bauer
2016/10/14 11:02:25
Also... do you actually need to call an explicit c
raymes
2016/10/15 03:51:09
Done.
|
| host_content_settings_map->AddObserver(&observer); |
| } |
| @@ -126,7 +131,7 @@ void ChromePluginServiceFilter::RegisterResourceContext(Profile* profile, |
| resource_context_map_[context] = base::MakeUnique<ContextInfo>( |
| PluginPrefs::GetForProfile(profile), |
| HostContentSettingsMapFactory::GetForProfile(profile), |
| - profile); |
| + FlashTemporaryPermissionTracker::Get(profile), profile); |
| } |
| void ChromePluginServiceFilter::UnregisterResourceContext( |
| @@ -237,14 +242,19 @@ bool ChromePluginServiceFilter::IsPluginAvailable( |
| UMA_HISTOGRAM_COUNTS_100(kEngagementNoSettingHistogram, engagement); |
| - // The content setting is neither ALLOW or BLOCK. Check whether the site |
| - // meets the engagement cutoff for making Flash available without a prompt. |
| - // This should only happen if the setting isn't being enforced by an |
| - // enterprise policy. |
| - if (is_managed || |
| - engagement < PluginsFieldTrial::GetSiteEngagementThresholdForFlash()) { |
| - return false; |
| + // If the content setting is being managed by enterprise policy and is an |
| + // ASK setting, we check to see if it has been temporarily granted. |
| + if (is_managed) { |
| + return context_info_it->second->permission_tracker->IsFlashEnabled( |
| + main_frame_origin.GetURL()); |
| } |
| + |
| + // If the content setting isn't managed by enterprise policy, but is ASK, |
| + // check whether the site meets the engagement cutoff for making Flash |
| + // available without a prompt.This should only happen if the setting isn't |
| + // being enforced by an enterprise policy. |
| + if (engagement < PluginsFieldTrial::GetSiteEngagementThresholdForFlash()) |
| + return false; |
| } |
| return true; |