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

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

Issue 2208463002: [HBD] Implement site-origin exceptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hbd_disableplugincache
Patch Set: Rebase Created 4 years, 4 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 | « no previous file | chrome/browser/plugins/plugin_filter_utils.h » ('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 c045356f0cad3637c962a47edff9d7e4ac9e0276..601611902cba1c3a59424672d93c2927e61e9924 100644
--- a/chrome/browser/plugins/chrome_plugin_service_filter.cc
+++ b/chrome/browser/plugins/chrome_plugin_service_filter.cc
@@ -13,6 +13,7 @@
#include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/plugins/plugin_filter_utils.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "chrome/browser/plugins/plugin_metadata.h"
#include "chrome/browser/plugins/plugin_prefs.h"
@@ -22,6 +23,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/content/common/content_settings_messages.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/content_settings/core/browser/plugins_field_trial.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h"
#include "content/public/browser/browser_thread.h"
@@ -128,13 +130,24 @@ bool ChromePluginServiceFilter::IsPluginAvailable(
host_content_settings_maps_.find(context);
DCHECK(host_content_settings_map_it != host_content_settings_maps_.end());
- // TODO(trizzofo): Implement site-origin exceptions once we have the
- // top-level frame origin.
- ContentSetting content_setting =
- host_content_settings_map_it->second->GetDefaultContentSetting(
- CONTENT_SETTINGS_TYPE_PLUGINS, nullptr);
- if (content_setting == CONTENT_SETTING_BLOCK)
+ ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
+ std::unique_ptr<PluginMetadata> plugin_metadata =
+ PluginFinder::GetInstance()->GetPluginMetadata(*plugin);
+ // When IsPluginAvailable() is called to check whether a plugin should be
+ // advertised, |url| has the same value of |policy_url| (i.e. the main frame
+ // origin). The intended behavior is that Flash is advertised only if a
+ // Flash embed hosted on the same origin as the main frame origin is allowed
+ // to run.
+ GetPluginContentSetting(host_content_settings_map_it->second.get(), *plugin,
+ policy_url, url, plugin_metadata->identifier(),
+ &plugin_setting, nullptr, nullptr);
+ plugin_setting =
+ content_settings::PluginsFieldTrial::EffectiveContentSetting(
+ CONTENT_SETTINGS_TYPE_PLUGINS, plugin_setting);
+ if (plugin_setting == CONTENT_SETTING_BLOCK ||
+ plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
return false;
+ }
}
return true;
« no previous file with comments | « no previous file | chrome/browser/plugins/plugin_filter_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698