Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2458)

Unified Diff: chrome/browser/plugins/chrome_plugin_service_filter.cc

Issue 2413683005: [HBD] If DefaultPluginPolicy set to 3, prompt should allow flash for the next page load only (Closed)
Patch Set: [HBD] If DefaultPluginPolicy set to 3, prompt should allow flash for the next page load only Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698