Add a new PluginInfoProvider class, to replace PluginStrategy
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Aug 2016 23:43:50 +0000 (23:43 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Aug 2016 23:43:50 +0000 (23:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160670

Reviewed by Sam Weinig.

Source/WebCore:

Add a per page PluginInfoProvider class that's going to ultimately replace the plug-in strategy.

* WebCore.xcodeproj/project.pbxproj:
* loader/EmptyClients.cpp:
(WebCore::fillWithEmptyClients):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::refreshPlugins):
(WebCore::Page::pluginData):
(WebCore::Page::pluginInfoProvider):
* page/Page.h:
* page/PageConfiguration.cpp:
* page/PageConfiguration.h:
* plugins/DOMPluginArray.cpp:
(WebCore::DOMPluginArray::refresh):
* plugins/DOMPluginArray.h:
* plugins/PluginData.cpp:
(WebCore::PluginData::PluginData):
(WebCore::PluginData::webVisiblePlugins):
(WebCore::PluginData::publiclyVisiblePlugins):
(WebCore::PluginData::initPlugins):
(WebCore::PluginData::refresh): Deleted.
* plugins/PluginData.h:
(WebCore::PluginData::create):
(WebCore::PluginData::PluginData): Deleted.
* plugins/PluginInfoProvider.cpp: Added.
(WebCore::PluginInfoProvider::~PluginInfoProvider):
(WebCore::PluginInfoProvider::addPage):
(WebCore::PluginInfoProvider::removePage):
* plugins/PluginInfoProvider.h: Added.
* replay/SerializationMethods.cpp:
(JSC::EncodingTraits<PluginData>::decodeValue):
(JSC::DeserializedPluginData::DeserializedPluginData): Deleted.

Source/WebKit:

Add new files.

* PlatformWin.cmake:
* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.

* WebCoreSupport/WebPluginInfoProvider.h: Added.
* WebCoreSupport/WebPluginInfoProvider.mm: Added.
(WebPluginInfoProvider::singleton):
(WebPluginInfoProvider::WebPluginInfoProvider):
(WebPluginInfoProvider::~WebPluginInfoProvider):
(WebPluginInfoProvider::refreshPlugins):
(WebPluginInfoProvider::getPluginInfo):
(WebPluginInfoProvider::getWebVisiblePluginInfo):
(WebPluginInfoProvider::setPluginLoadClientPolicy):
(WebPluginInfoProvider::clearPluginClientPolicies):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit/win:

Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.

* WebCoreSupport/WebPluginInfoProvider.cpp: Added.
(WebPluginInfoProvider::singleton):
(WebPluginInfoProvider::WebPluginInfoProvider):
(WebPluginInfoProvider::~WebPluginInfoProvider):
(WebPluginInfoProvider::refreshPlugins):
(WebPluginInfoProvider::getPluginInfo):
(WebPluginInfoProvider::getWebVisiblePluginInfo):
* WebCoreSupport/WebPluginInfoProvider.h: Added.

Source/WebKit2:

Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.

* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Plugins/WebPluginInfoProvider.cpp: Added.
(WebKit::WebPluginInfoProvider::singleton):
(WebKit::WebPluginInfoProvider::WebPluginInfoProvider):
(WebKit::WebPluginInfoProvider::~WebPluginInfoProvider):
(WebKit::WebPluginInfoProvider::refreshPlugins):
(WebKit::WebPluginInfoProvider::getPluginInfo):
(WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
(WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
(WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
* WebProcess/Plugins/WebPluginInfoProvider.h: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_userInterfaceLayoutDirection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204268 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/loader/EmptyClients.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/PageConfiguration.cpp
Source/WebCore/page/PageConfiguration.h
Source/WebCore/plugins/DOMPluginArray.cpp
Source/WebCore/plugins/DOMPluginArray.h
Source/WebCore/plugins/PluginData.cpp
Source/WebCore/plugins/PluginData.h
Source/WebCore/plugins/PluginInfoProvider.cpp [new file with mode: 0644]
Source/WebCore/plugins/PluginInfoProvider.h [new file with mode: 0644]
Source/WebCore/replay/SerializationMethods.cpp
Source/WebKit/ChangeLog
Source/WebKit/PlatformWin.cmake
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.h [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.mm [new file with mode: 0644]
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.cpp [new file with mode: 0644]
Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.h [new file with mode: 0644]
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index ca8a8c9..615febb 100644 (file)
@@ -2401,6 +2401,7 @@ set(WebCore_SOURCES
     plugins/DOMPlugin.cpp
     plugins/DOMPluginArray.cpp
     plugins/PluginData.cpp
+    plugins/PluginInfoProvider.cpp
 
     rendering/AutoTableLayout.cpp
     rendering/BidiRun.cpp
index 72e923d..16446a9 100644 (file)
@@ -1,3 +1,45 @@
+2016-08-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a new PluginInfoProvider class, to replace PluginStrategy
+        https://bugs.webkit.org/show_bug.cgi?id=160670
+
+        Reviewed by Sam Weinig.
+
+        Add a per page PluginInfoProvider class that's going to ultimately replace the plug-in strategy.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/EmptyClients.cpp:
+        (WebCore::fillWithEmptyClients):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::~Page):
+        (WebCore::Page::refreshPlugins):
+        (WebCore::Page::pluginData):
+        (WebCore::Page::pluginInfoProvider):
+        * page/Page.h:
+        * page/PageConfiguration.cpp:
+        * page/PageConfiguration.h:
+        * plugins/DOMPluginArray.cpp:
+        (WebCore::DOMPluginArray::refresh):
+        * plugins/DOMPluginArray.h:
+        * plugins/PluginData.cpp:
+        (WebCore::PluginData::PluginData):
+        (WebCore::PluginData::webVisiblePlugins):
+        (WebCore::PluginData::publiclyVisiblePlugins):
+        (WebCore::PluginData::initPlugins):
+        (WebCore::PluginData::refresh): Deleted.
+        * plugins/PluginData.h:
+        (WebCore::PluginData::create):
+        (WebCore::PluginData::PluginData): Deleted.
+        * plugins/PluginInfoProvider.cpp: Added.
+        (WebCore::PluginInfoProvider::~PluginInfoProvider):
+        (WebCore::PluginInfoProvider::addPage):
+        (WebCore::PluginInfoProvider::removePage):
+        * plugins/PluginInfoProvider.h: Added.
+        * replay/SerializationMethods.cpp:
+        (JSC::EncodingTraits<PluginData>::decodeValue):
+        (JSC::DeserializedPluginData::DeserializedPluginData): Deleted.
+
 2016-08-08  John Wilander  <wilander@apple.com>
 
         Popups opened from a sandboxed iframe should themselves be sandboxed
index 34a2877..27c2f89 100644 (file)
                19BFF64F11C0F2AC00B8C04D /* JSSVGFEConvolveMatrixElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 19BFF64A11C0F2AC00B8C04D /* JSSVGFEConvolveMatrixElement.h */; };
                1A0409DC1A4360B5009E47F3 /* MachSendRight.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0409DB1A4360B5009E47F3 /* MachSendRight.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A0409F31A43675C009E47F3 /* MachSendRight.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0409F21A43675C009E47F3 /* MachSendRight.cpp */; };
+               1A08FEDC1D592B8B008BA8CB /* PluginInfoProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A08FEDA1D592B8B008BA8CB /* PluginInfoProvider.cpp */; };
+               1A08FEDD1D592B8B008BA8CB /* PluginInfoProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A08FEDB1D592B8B008BA8CB /* PluginInfoProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */; };
                1A0D57370A5C77FE007EDD4C /* OverflowEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0D57350A5C77FE007EDD4C /* OverflowEvent.h */; };
                1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0D573E0A5C7867007EDD4C /* JSOverflowEvent.cpp */; };
                19BFF64A11C0F2AC00B8C04D /* JSSVGFEConvolveMatrixElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGFEConvolveMatrixElement.h; sourceTree = "<group>"; };
                1A0409DB1A4360B5009E47F3 /* MachSendRight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachSendRight.h; sourceTree = "<group>"; };
                1A0409F21A43675C009E47F3 /* MachSendRight.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachSendRight.cpp; sourceTree = "<group>"; };
+               1A08FEDA1D592B8B008BA8CB /* PluginInfoProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoProvider.cpp; sourceTree = "<group>"; };
+               1A08FEDB1D592B8B008BA8CB /* PluginInfoProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoProvider.h; sourceTree = "<group>"; };
                1A0D57340A5C77FE007EDD4C /* OverflowEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OverflowEvent.cpp; sourceTree = "<group>"; };
                1A0D57350A5C77FE007EDD4C /* OverflowEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OverflowEvent.h; sourceTree = "<group>"; };
                1A0D57380A5C7812007EDD4C /* OverflowEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = OverflowEvent.idl; sourceTree = "<group>"; };
                                1A927FD11416A15B003A83C8 /* nptypes.h */,
                                A9C6E4F10D745E48006442E9 /* PluginData.cpp */,
                                A9C6E4F20D745E48006442E9 /* PluginData.h */,
+                               1A08FEDA1D592B8B008BA8CB /* PluginInfoProvider.cpp */,
+                               1A08FEDB1D592B8B008BA8CB /* PluginInfoProvider.h */,
                                1AA8798F11CBE846003C664F /* PluginStrategy.h */,
                                0AFDAC3C10F5448C00E1F3D2 /* PluginViewBase.h */,
                        );
                                B2227A2D0D00BF220071B782 /* SVGImageElement.h in Headers */,
                                08F859D51463F9CD0067D934 /* SVGImageForContainer.h in Headers */,
                                B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */,
+                               1A08FEDD1D592B8B008BA8CB /* PluginInfoProvider.h in Headers */,
                                0854B01F1255E4E600B9CDD0 /* SVGInlineFlowBox.h in Headers */,
                                0854B0211255E4E600B9CDD0 /* SVGInlineTextBox.h in Headers */,
                                B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */,
                                B2FA3DDC0AB75A6F000E5AC4 /* JSSVGPathSegMovetoAbs.cpp in Sources */,
                                B2FA3DDE0AB75A6F000E5AC4 /* JSSVGPathSegMovetoRel.cpp in Sources */,
                                B2FA3DE00AB75A6F000E5AC4 /* JSSVGPatternElement.cpp in Sources */,
+                               1A08FEDC1D592B8B008BA8CB /* PluginInfoProvider.cpp in Sources */,
                                8542A7960AE5C94200DF58DF /* JSSVGPoint.cpp in Sources */,
                                B2FA3DE20AB75A6F000E5AC4 /* JSSVGPointList.cpp in Sources */,
                                B2FA3DE50AB75A6F000E5AC4 /* JSSVGPolygonElement.cpp in Sources */,
index 4081de6..b01f245 100644 (file)
@@ -42,6 +42,7 @@
 #include "Page.h"
 #include "PageConfiguration.h"
 #include "PaymentCoordinatorClient.h"
+#include "PluginInfoProvider.h"
 #include "StorageArea.h"
 #include "StorageNamespace.h"
 #include "StorageNamespaceProvider.h"
@@ -78,6 +79,16 @@ class EmptyDatabaseProvider final : public DatabaseProvider {
 #endif
 };
 
+class EmptyPluginInfoProvider final : public PluginInfoProvider {
+    void refreshPlugins() override { };
+    void getPluginInfo(Page&, Vector<PluginInfo>&) override { }
+    void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) override { }
+#if PLATFORM(MAC)
+    void setPluginLoadClientPolicy(PluginLoadClientPolicy, const String&, const String&, const String&) override { }
+    void clearPluginClientPolicies() override { }
+#endif
+};
+
 class EmptyStorageNamespaceProvider final : public StorageNamespaceProvider {
     struct EmptyStorageArea : public StorageArea {
         unsigned length() override { return 0; }
@@ -163,6 +174,7 @@ void fillWithEmptyClients(PageConfiguration& pageConfiguration)
 
     pageConfiguration.applicationCacheStorage = ApplicationCacheStorage::create(String(), String());
     pageConfiguration.databaseProvider = adoptRef(new EmptyDatabaseProvider);
+    pageConfiguration.pluginInfoProvider = adoptRef(new EmptyPluginInfoProvider);
     pageConfiguration.storageNamespaceProvider = adoptRef(new EmptyStorageNamespaceProvider);
     pageConfiguration.userContentProvider = adoptRef(new EmptyUserContentProvider);
     pageConfiguration.visitedLinkStore = adoptRef(new EmptyVisitedLinkStore);
index ba08960..c94493d 100644 (file)
@@ -69,6 +69,7 @@
 #include "PageThrottler.h"
 #include "PlugInClient.h"
 #include "PluginData.h"
+#include "PluginInfoProvider.h"
 #include "PluginViewBase.h"
 #include "PointerLockController.h"
 #include "ProgressTracker.h"
@@ -233,6 +234,7 @@ Page::Page(PageConfiguration&& pageConfiguration)
     , m_socketProvider(WTFMove(pageConfiguration.socketProvider))
     , m_applicationCacheStorage(*WTFMove(pageConfiguration.applicationCacheStorage))
     , m_databaseProvider(*WTFMove(pageConfiguration.databaseProvider))
+    , m_pluginInfoProvider(*WTFMove(pageConfiguration.pluginInfoProvider))
     , m_storageNamespaceProvider(*WTFMove(pageConfiguration.storageNamespaceProvider))
     , m_userContentProvider(*WTFMove(pageConfiguration.userContentProvider))
     , m_visitedLinkStore(*WTFMove(pageConfiguration.visitedLinkStore))
@@ -241,8 +243,8 @@ Page::Page(PageConfiguration&& pageConfiguration)
 {
     updateTimerThrottlingState();
 
+    m_pluginInfoProvider->addPage(*this);
     m_storageNamespaceProvider->addPage(*this);
-
     m_userContentProvider->addPage(*this);
     m_visitedLinkStore->addPage(*this);
 
@@ -298,6 +300,7 @@ Page::~Page()
     pageCounter.decrement();
 #endif
 
+    m_pluginInfoProvider->removePage(*this);
     m_storageNamespaceProvider->removePage(*this);
     m_userContentProvider->removePage(*this);
     m_visitedLinkStore->removePage(*this);
@@ -507,11 +510,12 @@ void Page::refreshPlugins(bool reload)
     if (!allPages)
         return;
 
-    PluginData::refresh();
+    HashSet<PluginInfoProvider*> pluginInfoProviders;
 
     Vector<Ref<Frame>> framesNeedingReload;
 
     for (auto& page : *allPages) {
+        pluginInfoProviders.add(&page->pluginInfoProvider());
         page->m_pluginData = nullptr;
 
         if (!reload)
@@ -523,14 +527,17 @@ void Page::refreshPlugins(bool reload)
         }
     }
 
+    for (auto& pluginInfoProvider : pluginInfoProviders)
+        pluginInfoProvider->refreshPlugins();
+
     for (auto& frame : framesNeedingReload)
         frame->loader().reload();
 }
 
-PluginData& Page::pluginData() const
+PluginData& Page::pluginData()
 {
     if (!m_pluginData)
-        m_pluginData = PluginData::create(this);
+        m_pluginData = PluginData::create(*this);
     return *m_pluginData;
 }
 
@@ -1847,6 +1854,11 @@ bool Page::arePromptsAllowed()
     return !m_forbidPromptsDepth;
 }
 
+PluginInfoProvider& Page::pluginInfoProvider()
+{
+    return m_pluginInfoProvider;
+}
+
 UserContentProvider& Page::userContentProvider()
 {
     return m_userContentProvider;
index c0cfa48..f15da42 100644 (file)
@@ -108,6 +108,7 @@ class PageGroup;
 class PageThrottler;
 class PlugInClient;
 class PluginData;
+class PluginInfoProvider;
 class PluginViewBase;
 class PointerLockController;
 class ProgressTracker;
@@ -155,7 +156,7 @@ public:
     WEBCORE_EXPORT ViewportArguments viewportArguments() const;
 
     static void refreshPlugins(bool reload);
-    WEBCORE_EXPORT PluginData& pluginData() const;
+    WEBCORE_EXPORT PluginData& pluginData();
 
     WEBCORE_EXPORT void setCanStartMedia(bool);
     bool canStartMedia() const { return m_canStartMedia; }
@@ -466,6 +467,8 @@ public:
     StorageNamespaceProvider& storageNamespaceProvider() { return m_storageNamespaceProvider.get(); }
     void setStorageNamespaceProvider(Ref<StorageNamespaceProvider>&&);
 
+    PluginInfoProvider& pluginInfoProvider();
+
     UserContentProvider& userContentProvider();
     WEBCORE_EXPORT void setUserContentProvider(Ref<UserContentProvider>&&);
 
@@ -585,7 +588,7 @@ private:
     const std::unique_ptr<BackForwardController> m_backForwardController;
     Ref<MainFrame> m_mainFrame;
 
-    mutable RefPtr<PluginData> m_pluginData;
+    RefPtr<PluginData> m_pluginData;
 
     RefPtr<RenderTheme> m_theme;
 
@@ -699,6 +702,7 @@ private:
     Ref<SocketProvider> m_socketProvider;
     Ref<ApplicationCacheStorage> m_applicationCacheStorage;
     Ref<DatabaseProvider> m_databaseProvider;
+    Ref<PluginInfoProvider> m_pluginInfoProvider;
     Ref<StorageNamespaceProvider> m_storageNamespaceProvider;
     Ref<UserContentProvider> m_userContentProvider;
     Ref<VisitedLinkStore> m_visitedLinkStore;
index eef30af..95e7926 100644 (file)
@@ -31,6 +31,7 @@
 #include "DatabaseProvider.h"
 #include "DiagnosticLoggingClient.h"
 #include "EditorClient.h"
+#include "PluginInfoProvider.h"
 #include "SocketProvider.h"
 #include "StorageNamespaceProvider.h"
 #include "UserContentController.h"
index dac2e96..22aeb82 100644 (file)
@@ -43,6 +43,7 @@ class FrameLoaderClient;
 class InspectorClient;
 class PaymentCoordinatorClient;
 class PlugInClient;
+class PluginInfoProvider;
 class ProgressTrackerClient;
 class SocketProvider;
 class StorageNamespaceProvider;
@@ -82,6 +83,7 @@ public:
 
     RefPtr<ApplicationCacheStorage> applicationCacheStorage;
     RefPtr<DatabaseProvider> databaseProvider;
+    RefPtr<PluginInfoProvider> pluginInfoProvider;
     RefPtr<StorageNamespaceProvider> storageNamespaceProvider;
     RefPtr<UserContentProvider> userContentProvider;
     RefPtr<VisitedLinkStore> visitedLinkStore;
index 383be16..c1e4e6f 100644 (file)
@@ -83,9 +83,15 @@ Vector<AtomicString> DOMPluginArray::supportedPropertyNames()
     return Vector<AtomicString>();
 }
 
-void DOMPluginArray::refresh(bool reload)
+void DOMPluginArray::refresh(bool reloadPages)
 {
-    Page::refreshPlugins(reload);
+    if (!m_frame)
+        return;
+
+    if (!m_frame->page())
+        return;
+
+    Page::refreshPlugins(reloadPages);
 }
 
 PluginData* DOMPluginArray::pluginData() const
index c6f7524..30c0b0f 100644 (file)
@@ -41,7 +41,7 @@ public:
     RefPtr<DOMPlugin> namedItem(const AtomicString& propertyName);
     Vector<AtomicString> supportedPropertyNames();
 
-    void refresh(bool reload);
+    void refresh(bool reloadPages);
 
 private:
     explicit DOMPluginArray(Frame*);
index c25358a..ae8b4aa 100644 (file)
 
 #include "LocalizedStrings.h"
 #include "Page.h"
-#include "PlatformStrategies.h"
-#include "PluginStrategy.h"
+#include "PluginInfoProvider.h"
 
 namespace WebCore {
 
-PluginData::PluginData(const Page* page)
+PluginData::PluginData(Page& page)
+    : m_page(page)
 {
-    ASSERT_ARG(page, page);
-
-    m_page = page;
     initPlugins();
 }
 
 Vector<PluginInfo> PluginData::webVisiblePlugins() const
 {
     Vector<PluginInfo> plugins;
-    platformStrategies()->pluginStrategy()->getWebVisiblePluginInfo(m_page, plugins);
+    m_page.pluginInfoProvider().getWebVisiblePluginInfo(m_page, plugins);
     return plugins;
 }
 
@@ -76,11 +73,11 @@ static bool shouldBePubliclyVisible(const PluginInfo& plugin)
 
 Vector<PluginInfo> PluginData::publiclyVisiblePlugins() const
 {
-    if (m_page->showAllPlugins())
+    if (m_page.showAllPlugins())
         return webVisiblePlugins();
     
     Vector<PluginInfo> allPlugins;
-    platformStrategies()->pluginStrategy()->getWebVisiblePluginInfo(m_page, allPlugins);
+    m_page.pluginInfoProvider().getWebVisiblePluginInfo(m_page, allPlugins);
 
     Vector<PluginInfo> plugins;
     for (auto&& plugin : allPlugins) {
@@ -181,16 +178,11 @@ bool PluginData::supportsMimeType(const String& mimeType, const AllowedPluginTyp
     return false;
 }
 
-void PluginData::refresh()
-{
-    platformStrategies()->pluginStrategy()->refreshPlugins();
-}
-
 void PluginData::initPlugins()
 {
     ASSERT(m_plugins.isEmpty());
 
-    platformStrategies()->pluginStrategy()->getPluginInfo(m_page, m_plugins);
+    m_page.pluginInfoProvider().getPluginInfo(m_page, m_plugins);
 }
 
 } // namespace WebCore
index b922897..b3635a4 100644 (file)
@@ -86,7 +86,7 @@ inline bool operator==(PluginInfo& a, PluginInfo& b)
 // FIXME: merge with PluginDatabase in the future
 class PluginData : public RefCounted<PluginData> {
 public:
-    static Ref<PluginData> create(const Page* page) { return adoptRef(*new PluginData(page)); }
+    static Ref<PluginData> create(Page& page) { return adoptRef(*new PluginData(page)); }
 
     const Vector<PluginInfo>& plugins() const { return m_plugins; }
     Vector<PluginInfo> webVisiblePlugins() const;
@@ -104,24 +104,15 @@ public:
 
     WEBCORE_EXPORT bool supportsMimeType(const String& mimeType, const AllowedPluginTypes) const;
 
-    static void refresh();
-
 private:
-    explicit PluginData(const Page*);
+    explicit PluginData(Page&);
     void initPlugins();
     bool getPluginInfoForWebVisibleMimeType(const String& mimeType, PluginInfo&) const;
     void getMimesAndPluginIndices(Vector<MimeClassInfo>&, Vector<size_t>&) const;
     void getMimesAndPluginIndiciesForPlugins(const Vector<PluginInfo>&, Vector<MimeClassInfo>&, Vector<size_t>&) const;
 
 protected:
-#if defined ENABLE_WEB_REPLAY && ENABLE_WEB_REPLAY
-    PluginData(Vector<PluginInfo> plugins)
-        : m_plugins(plugins)
-    {
-    }
-#endif
-
-    const Page* m_page;
+    Page& m_page;
     Vector<PluginInfo> m_plugins;
 };
 
diff --git a/Source/WebCore/plugins/PluginInfoProvider.cpp b/Source/WebCore/plugins/PluginInfoProvider.cpp
new file mode 100644 (file)
index 0000000..0932b90
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PluginInfoProvider.h"
+
+namespace WebCore {
+
+PluginInfoProvider::~PluginInfoProvider()
+{
+    ASSERT(m_pages.isEmpty());
+}
+
+void PluginInfoProvider::addPage(Page& page)
+{
+    ASSERT(!m_pages.contains(&page));
+
+    m_pages.add(&page);
+}
+
+void PluginInfoProvider::removePage(Page& page)
+{
+    ASSERT(m_pages.contains(&page));
+
+    m_pages.remove(&page);
+}
+
+}
diff --git a/Source/WebCore/plugins/PluginInfoProvider.h b/Source/WebCore/plugins/PluginInfoProvider.h
new file mode 100644 (file)
index 0000000..0ecfce2
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "PluginData.h"
+#include <wtf/HashSet.h>
+
+namespace WebCore {
+
+class WEBCORE_EXPORT PluginInfoProvider : public RefCounted<PluginInfoProvider> {
+public:
+    WEBCORE_EXPORT virtual ~PluginInfoProvider();
+
+    void refreshPlugins(bool reloadPages);
+
+    void addPage(Page&);
+    void removePage(Page&);
+
+    virtual void refreshPlugins() = 0;
+    virtual void getPluginInfo(Page&, Vector<PluginInfo>&) = 0;
+    virtual void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) = 0;
+#if PLATFORM(MAC)
+    virtual void setPluginLoadClientPolicy(PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) = 0;
+    virtual void clearPluginClientPolicies() = 0;
+#endif
+
+private:
+    HashSet<Page*> m_pages;
+};
+
+}
index 32bd453..48605b2 100644 (file)
@@ -448,20 +448,10 @@ EncodedValue EncodingTraits<PluginData>::encodeValue(RefPtr<PluginData> input)
     return encodedData;
 }
 
-class DeserializedPluginData : public PluginData {
-public:
-    DeserializedPluginData(Vector<PluginInfo> plugins)
-        : PluginData(plugins)
-    {
-    }
-};
-
-bool EncodingTraits<PluginData>::decodeValue(EncodedValue& encodedData, RefPtr<PluginData>& input)
+bool EncodingTraits<PluginData>::decodeValue(EncodedValue& encodedData, RefPtr<PluginData>&)
 {
-    DECODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins);
-
     // FIXME: This needs to work in terms of web-visible plug-ins.
-    input = adoptRef(new DeserializedPluginData(plugins));
+    DECODE_TYPE_WITH_KEY(encodedData, Vector<PluginInfo>, plugins);
 
     return true;
 }
index af9d50c..9341442 100644 (file)
@@ -1,3 +1,15 @@
+2016-08-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a new PluginInfoProvider class, to replace PluginStrategy
+        https://bugs.webkit.org/show_bug.cgi?id=160670
+
+        Reviewed by Sam Weinig.
+
+        Add new files.
+
+        * PlatformWin.cmake:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2016-08-04  Alex Christensen  <achristensen@webkit.org>
 
         [Mac][cmake] Fix the build after Objective-C bindings generator removal
index 628b273..45fa820 100644 (file)
@@ -246,6 +246,8 @@ list(APPEND WebKit_SOURCES_WebCoreSupport
     win/WebCoreSupport/WebInspectorDelegate.h
     win/WebCoreSupport/WebPlatformStrategies.cpp
     win/WebCoreSupport/WebPlatformStrategies.h
+    win/WebCoreSupport/WebPluginInfoProvider.cpp
+    win/WebCoreSupport/WebPluginInfoProvider.h
     win/WebCoreSupport/WebVisitedLinkStore.cpp
     win/WebCoreSupport/WebVisitedLinkStore.h
 )
index 991ce92..d988451 100644 (file)
@@ -19,6 +19,8 @@
                1430C12D1B2C5DF700DEA01D /* WebViewGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 1430C12B1B2C5DF700DEA01D /* WebViewGroup.h */; };
                14D8252F0AF955090004F057 /* WebChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D8252D0AF955090004F057 /* WebChromeClient.h */; };
                14D825300AF955090004F057 /* WebChromeClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 14D8252E0AF955090004F057 /* WebChromeClient.mm */; };
+               1A08FEE01D59376E008BA8CB /* WebPluginInfoProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A08FEDE1D59376E008BA8CB /* WebPluginInfoProvider.mm */; };
+               1A08FEE11D59376E008BA8CB /* WebPluginInfoProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A08FEDF1D59376E008BA8CB /* WebPluginInfoProvider.h */; };
                1A2DBE9F0F251E3A0036F8A6 /* ProxyInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */; };
                1A2DBEA00F251E3A0036F8A6 /* ProxyInstance.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */; };
                1A4DF5220EC8C74D006BD4B4 /* WebNetscapePluginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4DF5200EC8C74D006BD4B4 /* WebNetscapePluginView.h */; };
                1430C12B1B2C5DF700DEA01D /* WebViewGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewGroup.h; path = WebCoreSupport/WebViewGroup.h; sourceTree = SOURCE_ROOT; };
                14D8252D0AF955090004F057 /* WebChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebChromeClient.h; sourceTree = "<group>"; };
                14D8252E0AF955090004F057 /* WebChromeClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebChromeClient.mm; sourceTree = "<group>"; };
+               1A08FEDE1D59376E008BA8CB /* WebPluginInfoProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPluginInfoProvider.mm; sourceTree = "<group>"; };
+               1A08FEDF1D59376E008BA8CB /* WebPluginInfoProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginInfoProvider.h; sourceTree = "<group>"; };
                1A2DBE9D0F251E3A0036F8A6 /* ProxyInstance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyInstance.h; sourceTree = "<group>"; };
                1A2DBE9E0F251E3A0036F8A6 /* ProxyInstance.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProxyInstance.mm; sourceTree = "<group>"; };
                1A4DF5200EC8C74D006BD4B4 /* WebNetscapePluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNetscapePluginView.h; sourceTree = "<group>"; };
                                1AB1F76D1D1B260B007C9BD1 /* WebPaymentCoordinatorClient.mm */,
                                1AA879B411CBE9BF003C664F /* WebPlatformStrategies.h */,
                                1AA879B511CBE9BF003C664F /* WebPlatformStrategies.mm */,
+                               1A08FEDE1D59376E008BA8CB /* WebPluginInfoProvider.mm */,
+                               1A08FEDF1D59376E008BA8CB /* WebPluginInfoProvider.h */,
                                1A6A208C1886154600E50F5F /* WebProgressTrackerClient.h */,
                                1A6A208B1886154600E50F5F /* WebProgressTrackerClient.mm */,
                                E4AEF9791C0DF4BC00B01727 /* WebResourceLoadScheduler.cpp */,
                                1C8CB07A0AE9830C00B1F6E9 /* WebEditingDelegatePrivate.h in Headers */,
                                4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */,
                                DD89682009AA87240097E7F0 /* WebElementDictionary.h in Headers */,
+                               1A08FEE11D59376E008BA8CB /* WebPluginInfoProvider.h in Headers */,
                                A10C1D681820300E0036883A /* WebFixedPositionContent.h in Headers */,
                                A10C1D6A1820300E0036883A /* WebFixedPositionContentInternal.h in Headers */,
                                939810520824BF01008DF038 /* WebFormDelegate.h in Headers */,
                                1AAF5CF10EDDE586008D883D /* WebKitPluginHost.defs in Sources */,
                                939810C50824BF01008DF038 /* WebKitStatistics.m in Sources */,
                                1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
+                               1A08FEE01D59376E008BA8CB /* WebPluginInfoProvider.mm in Sources */,
                                ED5B9524111B725A00472298 /* WebLocalizableStrings.mm in Sources */,
                                BC42D34D131ED3880075FA4B /* WebLocalizableStringsInternal.mm in Sources */,
                                072E5F461ABF88750003B164 /* WebMediaPlaybackTargetPicker.mm in Sources */,
index 1e51438..2f1a545 100644 (file)
@@ -1,3 +1,25 @@
+2016-08-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a new PluginInfoProvider class, to replace PluginStrategy
+        https://bugs.webkit.org/show_bug.cgi?id=160670
+
+        Reviewed by Sam Weinig.
+
+        Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.
+
+        * WebCoreSupport/WebPluginInfoProvider.h: Added.
+        * WebCoreSupport/WebPluginInfoProvider.mm: Added.
+        (WebPluginInfoProvider::singleton):
+        (WebPluginInfoProvider::WebPluginInfoProvider):
+        (WebPluginInfoProvider::~WebPluginInfoProvider):
+        (WebPluginInfoProvider::refreshPlugins):
+        (WebPluginInfoProvider::getPluginInfo):
+        (WebPluginInfoProvider::getWebVisiblePluginInfo):
+        (WebPluginInfoProvider::setPluginLoadClientPolicy):
+        (WebPluginInfoProvider::clearPluginClientPolicies):
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+
 2016-08-02  Enrica Casucci  <enrica@apple.com>
 
         Allow building with content filtering disabled.
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.h b/Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.h
new file mode 100644 (file)
index 0000000..769f976
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebCore/PluginInfoProvider.h>
+
+class WebPluginInfoProvider final : public WebCore::PluginInfoProvider {
+    friend class NeverDestroyed<WebPluginInfoProvider>;
+
+public:
+    static WebPluginInfoProvider& singleton();
+    virtual ~WebPluginInfoProvider();
+
+private:
+    void refreshPlugins() override;
+    void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+    void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+#if PLATFORM(MAC)
+    void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) override;
+    void clearPluginClientPolicies() override;
+#endif
+
+    WebPluginInfoProvider();
+};
diff --git a/Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.mm b/Source/WebKit/mac/WebCoreSupport/WebPluginInfoProvider.mm
new file mode 100644 (file)
index 0000000..98d805a
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebPluginInfoProvider.h"
+
+// FIXME: We shouldn't call out to the platform strategy for this.
+#import "WebPlatformStrategies.h"
+#import <WebCore/PluginStrategy.h>
+
+using namespace WebCore;
+
+WebPluginInfoProvider& WebPluginInfoProvider::singleton()
+{
+    static WebPluginInfoProvider& pluginInfoProvider = adoptRef(*new WebPluginInfoProvider).leakRef();
+
+    return pluginInfoProvider;
+}
+
+WebPluginInfoProvider::WebPluginInfoProvider()
+{
+}
+
+WebPluginInfoProvider::~WebPluginInfoProvider()
+{
+}
+
+void WebPluginInfoProvider::refreshPlugins()
+{
+    platformStrategies()->pluginStrategy()->refreshPlugins();
+}
+
+void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    platformStrategies()->pluginStrategy()->getPluginInfo(&page, plugins);
+}
+
+void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    platformStrategies()->pluginStrategy()->getWebVisiblePluginInfo(&page, plugins);
+}
+
+#if PLATFORM(MAC)
+void WebPluginInfoProvider::setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString)
+{
+}
+
+void WebPluginInfoProvider::clearPluginClientPolicies()
+{
+}
+#endif
+
index 6f87b40..364cb54 100644 (file)
@@ -92,6 +92,7 @@
 #import "WebPaymentCoordinatorClient.h"
 #import "WebPlatformStrategies.h"
 #import "WebPluginDatabase.h"
+#import "WebPluginInfoProvider.h"
 #import "WebPolicyDelegate.h"
 #import "WebPreferenceKeysPrivate.h"
 #import "WebPreferencesPrivate.h"
@@ -1018,6 +1019,7 @@ static void WebKitInitializeGamepadProviderIfNecessary()
     pageConfiguration.progressTrackerClient = new WebProgressTrackerClient(self);
     pageConfiguration.applicationCacheStorage = &webApplicationCacheStorage();
     pageConfiguration.databaseProvider = &WebDatabaseProvider::singleton();
+    pageConfiguration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
     pageConfiguration.storageNamespaceProvider = &_private->group->storageNamespaceProvider();
     pageConfiguration.userContentProvider = &_private->group->userContentController();
     pageConfiguration.visitedLinkStore = &_private->group->visitedLinkStore();
index d467c4f..b9e0ffd 100644 (file)
@@ -1,3 +1,21 @@
+2016-08-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a new PluginInfoProvider class, to replace PluginStrategy
+        https://bugs.webkit.org/show_bug.cgi?id=160670
+
+        Reviewed by Sam Weinig.
+
+        Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.
+
+        * WebCoreSupport/WebPluginInfoProvider.cpp: Added.
+        (WebPluginInfoProvider::singleton):
+        (WebPluginInfoProvider::WebPluginInfoProvider):
+        (WebPluginInfoProvider::~WebPluginInfoProvider):
+        (WebPluginInfoProvider::refreshPlugins):
+        (WebPluginInfoProvider::getPluginInfo):
+        (WebPluginInfoProvider::getWebVisiblePluginInfo):
+        * WebCoreSupport/WebPluginInfoProvider.h: Added.
+
 2016-07-29  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Remove PassRef.h after r177259
diff --git a/Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.cpp b/Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.cpp
new file mode 100644 (file)
index 0000000..a7f72db
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebPluginInfoProvider.h"
+
+// FIXME: We shouldn't call out to the platform strategy for this.
+#include "WebPlatformStrategies.h"
+#include <WebCore/PluginStrategy.h>
+
+using namespace WebCore;
+
+WebPluginInfoProvider& WebPluginInfoProvider::singleton()
+{
+    static WebPluginInfoProvider& pluginInfoProvider = adoptRef(*new WebPluginInfoProvider).leakRef();
+
+    return pluginInfoProvider;
+}
+
+WebPluginInfoProvider::WebPluginInfoProvider()
+{
+}
+
+WebPluginInfoProvider::~WebPluginInfoProvider()
+{
+}
+
+void WebPluginInfoProvider::refreshPlugins()
+{
+    platformStrategies()->pluginStrategy()->refreshPlugins();
+}
+
+void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    platformStrategies()->pluginStrategy()->getPluginInfo(&page, plugins);
+}
+
+void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    platformStrategies()->pluginStrategy()->getWebVisiblePluginInfo(&page, plugins);
+}
diff --git a/Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.h b/Source/WebKit/win/WebCoreSupport/WebPluginInfoProvider.h
new file mode 100644 (file)
index 0000000..a815cc8
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebCore/PluginInfoProvider.h>
+
+class WebPluginInfoProvider final : public WebCore::PluginInfoProvider {
+    friend class NeverDestroyed<WebPluginInfoProvider>;
+
+public:
+    static WebPluginInfoProvider& singleton();
+    virtual ~WebPluginInfoProvider();
+
+private:
+    void refreshPlugins() override;
+    void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+    void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+#if PLATFORM(MAC)
+    void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) override;
+    void clearPluginClientPolicies() override;
+#endif
+
+    WebPluginInfoProvider();
+};
index a684255..7bf6c7f 100644 (file)
@@ -590,6 +590,7 @@ set(WebKit2_SOURCES
     WebProcess/Plugins/PluginProcessConnectionManager.cpp
     WebProcess/Plugins/PluginProxy.cpp
     WebProcess/Plugins/PluginView.cpp
+    WebProcess/Plugins/WebPluginInfoProvider.cpp
 
     WebProcess/Plugins/Netscape/JSNPMethod.cpp
     WebProcess/Plugins/Netscape/JSNPObject.cpp
index dfd0ff3..0ba84da 100644 (file)
@@ -1,3 +1,26 @@
+2016-08-08  Anders Carlsson  <andersca@apple.com>
+
+        Add a new PluginInfoProvider class, to replace PluginStrategy
+        https://bugs.webkit.org/show_bug.cgi?id=160670
+
+        Reviewed by Sam Weinig.
+
+        Add a new WebPluginInfoProvider - it just calls through to the plug-in strategy for now.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/Plugins/WebPluginInfoProvider.cpp: Added.
+        (WebKit::WebPluginInfoProvider::singleton):
+        (WebKit::WebPluginInfoProvider::WebPluginInfoProvider):
+        (WebKit::WebPluginInfoProvider::~WebPluginInfoProvider):
+        (WebKit::WebPluginInfoProvider::refreshPlugins):
+        (WebKit::WebPluginInfoProvider::getPluginInfo):
+        (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
+        (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
+        (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
+        * WebProcess/Plugins/WebPluginInfoProvider.h: Added.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_userInterfaceLayoutDirection):
+
 2016-08-08  Brady Eidson  <beidson@apple.com>
 
         Addressing late review feedback in bug 160605
index 341f41e..2dc8f90 100644 (file)
                1A07D2F91919B3A900ECDA16 /* messages.py in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 0FC0856F187CE0A900780D86 /* messages.py */; };
                1A07D2FA1919B3A900ECDA16 /* model.py in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 0FC08570187CE0A900780D86 /* model.py */; };
                1A07D2FB1919B3A900ECDA16 /* parser.py in Copy Message Generation Scripts */ = {isa = PBXBuildFile; fileRef = 0FC08571187CE0A900780D86 /* parser.py */; };
+               1A08FEE41D593E2A008BA8CB /* WebPluginInfoProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A08FEE21D593CF1008BA8CB /* WebPluginInfoProvider.cpp */; };
                1A0EC603124A9F2C007EF4A5 /* PluginProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */; };
                1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */; };
                1A0EC6C0124BBD9B007EF4A5 /* PluginProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0EC6BE124BBD9B007EF4A5 /* PluginProcessMessages.h */; };
                1A043F6712514D8B00FFBFB5 /* WebProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessConnectionMessageReceiver.cpp; sourceTree = "<group>"; };
                1A043F6812514D8B00FFBFB5 /* WebProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessConnectionMessages.h; sourceTree = "<group>"; };
                1A04F6171A4A3A7A00A21B6E /* WebProcessProxyCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessProxyCocoa.mm; sourceTree = "<group>"; };
+               1A08FEE21D593CF1008BA8CB /* WebPluginInfoProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPluginInfoProvider.cpp; sourceTree = "<group>"; };
+               1A08FEE31D593CF1008BA8CB /* WebPluginInfoProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginInfoProvider.h; sourceTree = "<group>"; };
                1A0EC601124A9F2C007EF4A5 /* PluginProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessManager.h; sourceTree = "<group>"; };
                1A0EC602124A9F2C007EF4A5 /* PluginProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginProcessManager.cpp; sourceTree = "<group>"; };
                1A0EC6B1124BBD36007EF4A5 /* PluginProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PluginProcess.messages.in; sourceTree = "<group>"; };
                                1A8EFA5B1252B7CE00F7067F /* PluginProxy.messages.in */,
                                1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */,
                                1A6FB7AD11E64B6800DB1371 /* PluginView.h */,
+                               1A08FEE21D593CF1008BA8CB /* WebPluginInfoProvider.cpp */,
+                               1A08FEE31D593CF1008BA8CB /* WebPluginInfoProvider.h */,
                        );
                        path = Plugins;
                        sourceTree = "<group>";
                                1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */,
                                1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */,
                                1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */,
+                               1A08FEE41D593E2A008BA8CB /* WebPluginInfoProvider.cpp in Sources */,
                                1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
                                1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */,
                                BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */,
diff --git a/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp b/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.cpp
new file mode 100644 (file)
index 0000000..8f56dde
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPluginInfoProvider.h"
+
+// FIXME: We shouldn't call out to the platform strategy for this.
+#include "WebPlatformStrategies.h"
+#include <WebCore/PluginStrategy.h>
+
+namespace WebKit {
+
+WebPluginInfoProvider& WebPluginInfoProvider::singleton()
+{
+    static WebPluginInfoProvider& pluginInfoProvider = adoptRef(*new WebPluginInfoProvider).leakRef();
+
+    return pluginInfoProvider;
+}
+
+WebPluginInfoProvider::WebPluginInfoProvider()
+{
+}
+
+WebPluginInfoProvider::~WebPluginInfoProvider()
+{
+}
+
+void WebPluginInfoProvider::refreshPlugins()
+{
+    WebCore::platformStrategies()->pluginStrategy()->refreshPlugins();
+}
+
+void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    WebCore::platformStrategies()->pluginStrategy()->getPluginInfo(&page, plugins);
+}
+
+void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+{
+    WebCore::platformStrategies()->pluginStrategy()->getWebVisiblePluginInfo(&page, plugins);
+}
+
+#if PLATFORM(MAC)
+void WebPluginInfoProvider::setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy pluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString)
+{
+    WebCore::platformStrategies()->pluginStrategy()->setPluginLoadClientPolicy(pluginLoadClientPolicy, host, bundleIdentifier, versionString);
+}
+
+void WebPluginInfoProvider::clearPluginClientPolicies()
+{
+    WebCore::platformStrategies()->pluginStrategy()->clearPluginClientPolicies();
+}
+#endif
+
+}
diff --git a/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.h b/Source/WebKit2/WebProcess/Plugins/WebPluginInfoProvider.h
new file mode 100644 (file)
index 0000000..79c0ded
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <WebCore/PluginInfoProvider.h>
+
+namespace WebKit {
+
+class WebPluginInfoProvider final : public WebCore::PluginInfoProvider {
+    friend class NeverDestroyed<WebPluginInfoProvider>;
+
+public:
+    static WebPluginInfoProvider& singleton();
+    virtual ~WebPluginInfoProvider();
+
+private:
+    void refreshPlugins() override;
+    void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+    void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+#if PLATFORM(MAC)
+    void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) override;
+    void clearPluginClientPolicies() override;
+#endif
+
+    WebPluginInfoProvider();
+};
+
+}
index 3b35eaa..9969066 100644 (file)
@@ -96,6 +96,7 @@
 #include "WebPageProxyMessages.h"
 #include "WebPaymentCoordinator.h"
 #include "WebPlugInClient.h"
+#include "WebPluginInfoProvider.h"
 #include "WebPopupMenu.h"
 #include "WebPreferencesDefinitions.h"
 #include "WebPreferencesKeys.h"
@@ -411,6 +412,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 
     pageConfiguration.applicationCacheStorage = &WebProcess::singleton().applicationCacheStorage();
     pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroup->pageGroupID());
+    pageConfiguration.pluginInfoProvider = &WebPluginInfoProvider::singleton();
     pageConfiguration.storageNamespaceProvider = WebStorageNamespaceProvider::getOrCreate(m_pageGroup->pageGroupID());
     pageConfiguration.userContentProvider = m_userContentController.ptr();
     pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);