From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/plugins/PluginData.h | 70 +++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 18 deletions(-) (limited to 'Source/WebCore/plugins/PluginData.h') diff --git a/Source/WebCore/plugins/PluginData.h b/Source/WebCore/plugins/PluginData.h index fec7ace74..0893fc99a 100644 --- a/Source/WebCore/plugins/PluginData.h +++ b/Source/WebCore/plugins/PluginData.h @@ -1,5 +1,6 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + Copyright (C) 2015 Apple Inc. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -17,8 +18,7 @@ Boston, MA 02110-1301, USA. */ -#ifndef PluginData_h -#define PluginData_h +#pragma once #include #include @@ -29,6 +29,24 @@ namespace WebCore { class Page; struct PluginInfo; +enum PluginLoadClientPolicy : uint8_t { + // No client-specific plug-in load policy has been defined. The plug-in should be visible in navigator.plugins and WebKit should synchronously + // ask the client whether the plug-in should be loaded. + PluginLoadClientPolicyUndefined = 0, + + // The plug-in module should be blocked from being instantiated. The plug-in should be hidden in navigator.plugins. + PluginLoadClientPolicyBlock, + + // WebKit should synchronously ask the client whether the plug-in should be loaded. The plug-in should be visible in navigator.plugins. + PluginLoadClientPolicyAsk, + + // The plug-in module may be loaded if WebKit is not blocking it. + PluginLoadClientPolicyAllow, + + // The plug-in module should be loaded irrespective of whether WebKit has asked it to be blocked. + PluginLoadClientPolicyAllowAlways, +}; + struct MimeClassInfo { String type; String desc; @@ -46,38 +64,54 @@ struct PluginInfo { String desc; Vector mimes; bool isApplicationPlugin; + + PluginLoadClientPolicy clientLoadPolicy; + +#if PLATFORM(MAC) + String bundleIdentifier; + String versionString; +#endif }; +inline bool operator==(PluginInfo& a, PluginInfo& b) +{ + bool result = a.name == b.name && a.file == b.file && a.desc == b.desc && a.mimes == b.mimes && a.isApplicationPlugin == b.isApplicationPlugin && a.clientLoadPolicy == b.clientLoadPolicy; +#if PLATFORM(MAC) + result = result && a.bundleIdentifier == b.bundleIdentifier && a.versionString == b.versionString; +#endif + return result; +} + // FIXME: merge with PluginDatabase in the future class PluginData : public RefCounted { public: - static PassRefPtr create(const Page* page) { return adoptRef(new PluginData(page)); } + static Ref create(Page& page) { return adoptRef(*new PluginData(page)); } const Vector& plugins() const { return m_plugins; } - const Vector& mimes() const { return m_mimes; } - const Vector& mimePluginIndices() const { return m_mimePluginIndices; } + Vector webVisiblePlugins() const; + Vector publiclyVisiblePlugins() const; + WEBCORE_EXPORT void getWebVisibleMimesAndPluginIndices(Vector&, Vector&) const; enum AllowedPluginTypes { AllPlugins, OnlyApplicationPlugins }; - bool supportsMimeType(const String& mimeType, const AllowedPluginTypes) const; - String pluginNameForMimeType(const String& mimeType) const; - String pluginFileForMimeType(const String& mimeType) const; + WEBCORE_EXPORT bool supportsWebVisibleMimeType(const String& mimeType, const AllowedPluginTypes) const; + String pluginFileForWebVisibleMimeType(const String& mimeType) const; - static void refresh(); + WEBCORE_EXPORT bool supportsMimeType(const String& mimeType, const AllowedPluginTypes) const; private: - explicit PluginData(const Page*); - void initPlugins(const Page*); - const PluginInfo* pluginInfoForMimeType(const String& mimeType) const; - + explicit PluginData(Page&); + void initPlugins(); + bool getPluginInfoForWebVisibleMimeType(const String& mimeType, PluginInfo&) const; + void getMimesAndPluginIndices(Vector&, Vector&) const; + void getMimesAndPluginIndiciesForPlugins(const Vector&, Vector&, Vector&) const; + +protected: + Page& m_page; Vector m_plugins; - Vector m_mimes; - Vector m_mimePluginIndices; }; -} - -#endif +} // namespace WebCore -- cgit v1.2.1