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

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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cdb0cc8cad7a5d866b283bd1043f195d0bf236cc 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"
@@ -64,14 +65,15 @@ void AuthorizeRenderer(content::RenderFrameHost* render_frame_host) {
// ChromePluginServiceFilter inner struct definitions.
struct ChromePluginServiceFilter::ContextInfo {
- ContextInfo(
- const scoped_refptr<PluginPrefs>& plugin_prefs,
- const scoped_refptr<HostContentSettingsMap>& host_content_settings_map,
- Profile* profile);
+ ContextInfo(scoped_refptr<PluginPrefs> pp,
+ scoped_refptr<HostContentSettingsMap> hcsm,
+ scoped_refptr<FlashTemporaryPermissionTracker> ftpm,
+ Profile* profile);
~ContextInfo();
scoped_refptr<PluginPrefs> plugin_prefs;
scoped_refptr<HostContentSettingsMap> host_content_settings_map;
+ scoped_refptr<FlashTemporaryPermissionTracker> permission_tracker;
ProfileContentSettingObserver observer;
private:
@@ -79,12 +81,14 @@ struct ChromePluginServiceFilter::ContextInfo {
};
ChromePluginServiceFilter::ContextInfo::ContextInfo(
- const scoped_refptr<PluginPrefs>& plugin_prefs,
- const scoped_refptr<HostContentSettingsMap>& host_content_settings_map,
+ scoped_refptr<PluginPrefs> pp,
+ scoped_refptr<HostContentSettingsMap> hcsm,
+ scoped_refptr<FlashTemporaryPermissionTracker> ftpm,
Profile* profile)
- : plugin_prefs(plugin_prefs),
- host_content_settings_map(host_content_settings_map),
- observer(ProfileContentSettingObserver(profile)) {
+ : plugin_prefs(std::move(pp)),
+ host_content_settings_map(std::move(hcsm)),
+ permission_tracker(std::move(ftpm)),
+ observer(profile) {
host_content_settings_map->AddObserver(&observer);
}
@@ -126,7 +130,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 +241,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;
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/plugins/chrome_plugin_service_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698