| Index: chrome/browser/plugins/plugin_info_message_filter.cc
|
| diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
|
| index 917e3db386d3a4ce241268e91a8d1e07536ecd2a..5588744e1da2d9c69490588accab5122d0b45ff3 100644
|
| --- a/chrome/browser/plugins/plugin_info_message_filter.cc
|
| +++ b/chrome/browser/plugins/plugin_info_message_filter.cc
|
| @@ -20,6 +20,7 @@
|
| #include "build/build_config.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
| +#include "chrome/browser/permissions/permission_result.h"
|
| #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
| #include "chrome/browser/plugins/plugin_finder.h"
|
| #include "chrome/browser/plugins/plugin_metadata.h"
|
| @@ -322,31 +323,35 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
|
| return;
|
| }
|
|
|
| - ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
|
| + PermissionResult plugin_result(CONTENT_SETTING_DEFAULT,
|
| + PermissionStatusSource::UNSPECIFIED);
|
| bool uses_default_content_setting = true;
|
| bool is_managed = false;
|
| // Check plugin content settings. The primary URL is the top origin URL and
|
| // the secondary URL is the plugin URL.
|
| PluginUtils::GetPluginContentSetting(
|
| host_content_settings_map_, plugin, main_frame_origin, url,
|
| - plugin_identifier, &plugin_setting, &uses_default_content_setting,
|
| + plugin_identifier, &plugin_result, &uses_default_content_setting,
|
| &is_managed);
|
|
|
| // TODO(tommycli): Remove once we deprecate the plugin ASK policy.
|
| - bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK;
|
| - plugin_setting = PluginsFieldTrial::EffectiveContentSetting(
|
| + bool legacy_ask_user = plugin_result.content_setting == CONTENT_SETTING_ASK;
|
| + plugin_result.content_setting = PluginsFieldTrial::EffectiveContentSetting(
|
| host_content_settings_map_, CONTENT_SETTINGS_TYPE_PLUGINS,
|
| - plugin_setting);
|
| + plugin_result.content_setting);
|
|
|
| - DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
| - DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
| + DCHECK(plugin_result.content_setting != CONTENT_SETTING_DEFAULT);
|
| + DCHECK(plugin_result.content_setting != CONTENT_SETTING_ASK);
|
|
|
| if (*status ==
|
| ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml) {
|
| - if (plugin_setting == CONTENT_SETTING_BLOCK) {
|
| - *status = is_managed && !legacy_ask_user
|
| - ? ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy
|
| - : ChromeViewHostMsg_GetPluginInfo_Status::kBlockedNoLoading;
|
| + if (plugin_result.content_setting == CONTENT_SETTING_BLOCK) {
|
| + if (is_managed && !legacy_ask_user) {
|
| + *status = ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy;
|
| + plugin_result.source = PermissionStatusSource::ENTERPRISE_POLICY;
|
| + } else {
|
| + *status = ChromeViewHostMsg_GetPluginInfo_Status::kBlockedNoLoading;
|
| + }
|
| }
|
| return;
|
| }
|
| @@ -367,7 +372,7 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
|
| // Check if the plugin is crashing too much.
|
| if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) &&
|
| !always_authorize_plugins_.GetValue() &&
|
| - plugin_setting != CONTENT_SETTING_BLOCK &&
|
| + plugin_result.content_setting != CONTENT_SETTING_BLOCK &&
|
| uses_default_content_setting) {
|
| *status = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
|
| return;
|
| @@ -378,24 +383,29 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
|
| // in |accessible_resources| in the manifest, then allow them to be loaded by
|
| // plugins inside a guest-view.
|
| if (url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
|
| - plugin_setting == CONTENT_SETTING_BLOCK &&
|
| + plugin_result.content_setting == CONTENT_SETTING_BLOCK &&
|
| IsPluginLoadingAccessibleResourceInWebView(extension_registry_,
|
| render_process_id_, url)) {
|
| - plugin_setting = CONTENT_SETTING_ALLOW;
|
| + plugin_result.content_setting = CONTENT_SETTING_ALLOW;
|
| + plugin_result.source = PermissionStatusSource::EXTENSION;
|
| }
|
| #endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|
| - if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ||
|
| - (plugin_setting == CONTENT_SETTING_ALLOW &&
|
| + if (plugin_result.content_setting ==
|
| + CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ||
|
| + (plugin_result.content_setting == CONTENT_SETTING_ALLOW &&
|
| PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map_) &&
|
| !base::FeatureList::IsEnabled(features::kRunAllFlashInAllowMode))) {
|
| *status = ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
| - } else if (plugin_setting == CONTENT_SETTING_BLOCK) {
|
| + } else if (plugin_result.content_setting == CONTENT_SETTING_BLOCK) {
|
| // For managed users with the ASK policy, we allow manually running plugins
|
| // via context menu. This is the closest to admin intent.
|
| - *status = is_managed && !legacy_ask_user
|
| - ? ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy
|
| - : ChromeViewHostMsg_GetPluginInfo_Status::kBlocked;
|
| + if (is_managed && !legacy_ask_user) {
|
| + *status = ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy;
|
| + plugin_result.source = PermissionStatusSource::ENTERPRISE_POLICY;
|
| + } else {
|
| + *status = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked;
|
| + }
|
| }
|
|
|
| #if BUILDFLAG(ENABLE_EXTENSIONS)
|
|
|