#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/memory/singleton.h"
#include "build/branding_buildflags.h"
#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/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_metadata.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/plugins/plugin_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_otr_state.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/plugin.mojom.h"
#include "components/component_updater/component_updater_service.h"
#include "components/content_settings/core/browser/content_settings_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "components/nacl/common/buildflags.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/plugin_service_filter.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_constants.h"
#include "extensions/buildflags/buildflags.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "url/gurl.h"
#include "url/origin.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "components/guest_view/browser/guest_view_base.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/webview_info.h"
#endif
#if BUILDFLAG(ENABLE_NACL)
#include "components/nacl/common/nacl_constants.h"
#endif
PluginService;
WebPluginInfo;
namespace {
class PluginInfoHostImplShutdownNotifierFactory
: public BrowserContextKeyedServiceShutdownNotifierFactory { … };
std::unique_ptr<PluginMetadata> GetPluginMetadata(const WebPluginInfo& plugin) { … }
#if BUILDFLAG(ENABLE_EXTENSIONS)
bool IsPluginLoadingAccessibleResourceInWebView(
extensions::ExtensionRegistry* extension_registry,
int process_id,
const GURL& resource) { … }
#endif
}
PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
: … { … }
PluginInfoHostImpl::Context::~Context() = default;
PluginInfoHostImpl::PluginInfoHostImpl(int render_process_id, Profile* profile)
: … { … }
void PluginInfoHostImpl::ShutdownOnUIThread() { … }
PluginInfoHostImpl::~PluginInfoHostImpl() = default;
struct PluginInfoHostImpl::GetPluginInfo_Params { … };
void PluginInfoHostImpl::GetPluginInfo(const GURL& url,
const url::Origin& origin,
const std::string& mime_type,
GetPluginInfoCallback callback) { … }
void PluginInfoHostImpl::PluginsLoaded(
const GetPluginInfo_Params& params,
GetPluginInfoCallback callback,
const std::vector<WebPluginInfo>& plugins) { … }
void PluginInfoHostImpl::Context::DecidePluginStatus(
const GURL& url,
const url::Origin& main_frame_origin,
const WebPluginInfo& plugin,
PluginMetadata::SecurityStatus security_status,
const std::string& plugin_identifier,
chrome::mojom::PluginStatus* status) const { … }
bool PluginInfoHostImpl::Context::FindEnabledPlugin(
const GURL& url,
const std::string& mime_type,
chrome::mojom::PluginStatus* status,
WebPluginInfo* plugin,
std::string* actual_mime_type,
std::unique_ptr<PluginMetadata>* plugin_metadata) const { … }
void PluginInfoHostImpl::GetPluginInfoFinish(
const GetPluginInfo_Params& params,
chrome::mojom::PluginInfoPtr output,
GetPluginInfoCallback callback,
std::unique_ptr<PluginMetadata> plugin_metadata) { … }
void PluginInfoHostImpl::EnsureFactoryBuilt() { … }
void PluginInfoHostImpl::Context::MaybeGrantAccess(
chrome::mojom::PluginStatus status,
const base::FilePath& path) const { … }
bool PluginInfoHostImpl::Context::IsPluginEnabled(
const content::WebPluginInfo& plugin) const { … }