Title: [152824] trunk
Revision
152824
Author
[email protected]
Date
2013-07-17 17:43:18 -0700 (Wed, 17 Jul 2013)

Log Message

Update blocked/missing plug-in UI
https://bugs.webkit.org/show_bug.cgi?id=118347
<rdar://problem/14209318>

Reviewed by Sam Weinig.

* WebCore.exp.in:
Export RenderEmbeddedObject::setPluginUnavailabilityReasonWithDescription.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::replacementTextRoundedRectPressedColor):
(WebCore::replacementTextRoundedRectColor):
(WebCore::replacementTextColor):
Change colors to new design and add some more constants.

(WebCore::shouldUnavailablePluginMessageBeButton): Added.

(WebCore::RenderEmbeddedObject::setPluginUnavailabilityReasonWithDescription): Added.
(WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
Call through to the -WithDescription variant.

(WebCore::RenderEmbeddedObject::paintReplaced):
Fill the background, and otherwise match the new design.

(WebCore::addReplacementArrowPath):
Add an arrow to the given path, inside the given rect.

(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
Add a 1px padding to the bottom of the text.
Add a circle and an arrow into the indicator as per the new design.

(WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
Hit-test the indicator arrow as well; otherwise, the fact that the arrow
is a hole in the path means it won't be hit.

* rendering/RenderEmbeddedObject.h:

* Platform/CoreIPC/HandleMessage.h:
(CoreIPC::callMemberFunction):
Add a 6 argument -> 4 reply message handler.
(It seems that FindPlugin is getting a little out of hand.)

* Shared/APIClientTraits.cpp:
* Shared/APIClientTraits.h:
* UIProcess/API/C/WKPage.h:
* UIProcess/WebLoaderClient.cpp:
(WebKit::WebLoaderClient::pluginLoadPolicy):
* UIProcess/WebLoaderClient.h:
Add an unavailability description out-argument to a new version of
pluginLoadPolicy, so clients can override the text of the unavailable
plugin indicator. Bump the WKPageLoaderClient version and update APIClientTraits.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::findPlugin):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Plumb the unavailability description through to the WebProcess via
the FindPlugin message.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin):
Acquire the unavailability description from the client
(via FindPlugin) and hand it to the RenderEmbeddedObject.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController awakeFromNib]):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createWebViewWithOptions):
Match new WKPageLoaderClient entry.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152823 => 152824)


--- trunk/Source/WebCore/ChangeLog	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebCore/ChangeLog	2013-07-18 00:43:18 UTC (rev 152824)
@@ -1,3 +1,42 @@
+2013-07-17  Tim Horton  <[email protected]>
+
+        Update blocked/missing plug-in UI
+        https://bugs.webkit.org/show_bug.cgi?id=118347
+        <rdar://problem/14209318>
+
+        Reviewed by Sam Weinig.
+
+        * WebCore.exp.in:
+        Export RenderEmbeddedObject::setPluginUnavailabilityReasonWithDescription.
+
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::replacementTextRoundedRectPressedColor):
+        (WebCore::replacementTextRoundedRectColor):
+        (WebCore::replacementTextColor):
+        Change colors to new design and add some more constants.
+
+        (WebCore::shouldUnavailablePluginMessageBeButton): Added.
+
+        (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReasonWithDescription): Added.
+        (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
+        Call through to the -WithDescription variant.
+
+        (WebCore::RenderEmbeddedObject::paintReplaced):
+        Fill the background, and otherwise match the new design.
+
+        (WebCore::addReplacementArrowPath):
+        Add an arrow to the given path, inside the given rect.
+
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+        Add a 1px padding to the bottom of the text.
+        Add a circle and an arrow into the indicator as per the new design.
+
+        (WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
+        Hit-test the indicator arrow as well; otherwise, the fact that the arrow
+        is a hole in the path means it won't be hit.
+
+        * rendering/RenderEmbeddedObject.h:
+
 2013-07-17  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r152701, r152703, r152739, r152754,

Modified: trunk/Source/WebCore/WebCore.exp.in (152823 => 152824)


--- trunk/Source/WebCore/WebCore.exp.in	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-07-18 00:43:18 UTC (rev 152824)
@@ -669,6 +669,7 @@
 __ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE
 __ZN7WebCore20NodeRenderingContextD1Ev
 __ZN7WebCore20RenderEmbeddedObject29setPluginUnavailabilityReasonENS0_26PluginUnavailabilityReasonE
+__ZN7WebCore20RenderEmbeddedObject44setPluginUnavailabilityReasonWithDescriptionENS0_26PluginUnavailabilityReasonERKN3WTF6StringE
 __ZNK7WebCore20RenderEmbeddedObject21isReplacementObscuredEv
 __ZN7WebCore20ResourceHandleClient16didReceiveBufferEPNS_14ResourceHandleEN3WTF10PassRefPtrINS_12SharedBufferEEEi
 __ZN7WebCore20ResourceHandleClient20willSendRequestAsyncEPNS_14ResourceHandleERKNS_15ResourceRequestERKNS_16ResourceResponseE

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (152823 => 152824)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -65,21 +65,33 @@
 namespace WebCore {
 
 using namespace HTMLNames;
-    
+
 static const float replacementTextRoundedRectHeight = 18;
 static const float replacementTextRoundedRectLeftRightTextMargin = 6;
-static const float replacementTextRoundedRectOpacity = 0.20f;
-static const float replacementTextPressedRoundedRectOpacity = 0.65f;
+static const float replacementTextRoundedRectBottomTextPadding = 1;
+static const float replacementTextRoundedRectOpacity = 0.8f;
 static const float replacementTextRoundedRectRadius = 5;
-static const float replacementTextTextOpacity = 0.55f;
-static const float replacementTextPressedTextOpacity = 0.65f;
+static const float replacementArrowLeftMargin = 5;
+static const float replacementArrowPadding = 4;
 
 static const Color& replacementTextRoundedRectPressedColor()
 {
-    static const Color lightGray(205, 205, 205);
-    return lightGray;
+    static const Color pressed(205, 205, 205);
+    return pressed;
 }
-    
+
+static const Color& replacementTextRoundedRectColor()
+{
+    static const Color standard(221, 221, 221);
+    return standard;
+}
+
+static const Color& replacementTextColor()
+{
+    static const Color standard(102, 102, 102);
+    return standard;
+}
+
 RenderEmbeddedObject::RenderEmbeddedObject(Element* element)
     : RenderPart(element)
     , m_hasFallbackContent(false)
@@ -129,13 +141,27 @@
     return String();
 }
 
+static bool shouldUnavailablePluginMessageBeButton(Document* document, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
+{
+    Page* page = document->page();
+    return page && page->chrome().client()->shouldUnavailablePluginMessageBeButton(pluginUnavailabilityReason);
+}
+
 void RenderEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityReason pluginUnavailabilityReason)
 {
+    setPluginUnavailabilityReasonWithDescription(pluginUnavailabilityReason, unavailablePluginReplacementText(pluginUnavailabilityReason));
+}
+
+void RenderEmbeddedObject::setPluginUnavailabilityReasonWithDescription(PluginUnavailabilityReason pluginUnavailabilityReason, const String& description)
+{
     ASSERT(!m_showsUnavailablePluginIndicator);
     m_showsUnavailablePluginIndicator = true;
     m_pluginUnavailabilityReason = pluginUnavailabilityReason;
 
-    m_unavailablePluginReplacementText = unavailablePluginReplacementText(pluginUnavailabilityReason);
+    if (description.isEmpty())
+        m_unavailablePluginReplacementText = unavailablePluginReplacementText(pluginUnavailabilityReason);
+    else
+        m_unavailablePluginReplacementText = description;
 }
 
 bool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
@@ -147,7 +173,7 @@
 {
     if (m_unavailablePluginIndicatorIsPressed == pressed)
         return;
-    
+
     m_unavailablePluginIndicatorIsPressed = pressed;
     repaint();
 }
@@ -221,39 +247,59 @@
 
     if (paintInfo.phase == PaintPhaseSelection)
         return;
-    
+
     GraphicsContext* context = paintInfo.context;
     if (context->paintingDisabled())
         return;
-    
+
     FloatRect contentRect;
     Path path;
     FloatRect replacementTextRect;
+    FloatRect arrowRect;
     Font font;
     TextRun run("");
     float textWidth;
-    if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementTextRect, font, run, textWidth))
+    if (!getReplacementTextGeometry(paintOffset, contentRect, path, replacementTextRect, arrowRect, font, run, textWidth))
         return;
-    
+
     GraphicsContextStateSaver stateSaver(*context);
     context->clip(contentRect);
-    context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPressedRoundedRectOpacity : replacementTextRoundedRectOpacity);
-    context->setFillColor(m_unavailablePluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : Color::white, style()->colorSpace());
+    context->setAlpha(replacementTextRoundedRectOpacity);
+    context->setFillColor(m_unavailablePluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : replacementTextRoundedRectColor(), style()->colorSpace());
     context->fillPath(path);
 
     const FontMetrics& fontMetrics = font.fontMetrics();
     float labelX = roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2);
     float labelY = roundf(replacementTextRect.location().y() + (replacementTextRect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent());
-    context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPressedTextOpacity : replacementTextTextOpacity);
-    context->setFillColor(Color::black, style()->colorSpace());
+    context->setFillColor(replacementTextColor(), style()->colorSpace());
     context->drawBidiText(font, run, FloatPoint(labelX, labelY));
 }
 
-bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, Font& font, TextRun& run, float& textWidth) const
+static void addReplacementArrowPath(Path& path, const FloatRect& insideRect)
 {
+    FloatRect insideRectWithMargin(insideRect);
+    insideRectWithMargin.inflate(-replacementArrowPadding);
+
+    FloatPoint center = insideRectWithMargin.center();
+    FloatSize arrowEdge(insideRectWithMargin.width() / 2, insideRectWithMargin.height() / 3);
+    FloatSize arrowHorizontalEdge(arrowEdge.width(), 0);
+    FloatSize arrowVerticalEdge(0, arrowEdge.height());
+
+    path.moveTo(FloatPoint(center.x(), insideRectWithMargin.y()));
+    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
+    path.addLineTo(path.currentPoint() - arrowHorizontalEdge);
+    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
+    path.addLineTo(path.currentPoint() + arrowHorizontalEdge);
+    path.addLineTo(path.currentPoint() + arrowVerticalEdge);
+    path.addLineTo(center + arrowHorizontalEdge);
+    path.closeSubpath();
+}
+
+bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path& path, FloatRect& replacementTextRect, FloatRect& arrowRect, Font& font, TextRun& run, float& textWidth) const
+{
     contentRect = contentBoxRect();
     contentRect.moveBy(roundedIntPoint(accumulatedOffset));
-    
+
     FontDescription fontDescription;
     RenderTheme::defaultTheme()->systemFont(CSSValueWebkitSmallControl, fontDescription);
     fontDescription.setWeight(FontWeightBold);
@@ -268,14 +314,24 @@
 
     run = TextRun(m_unavailablePluginReplacementText);
     textWidth = font.width(run);
-    
+
     replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
     float x = (contentRect.size().width() / 2 - replacementTextRect.size().width() / 2) + contentRect.location().x();
     float y = (contentRect.size().height() / 2 - replacementTextRect.size().height() / 2) + contentRect.location().y();
     replacementTextRect.setLocation(FloatPoint(x, y));
-    
+
+    replacementTextRect.setHeight(replacementTextRect.height() + replacementTextRoundedRectBottomTextPadding);
+
     path.addRoundedRect(replacementTextRect, FloatSize(replacementTextRoundedRectRadius, replacementTextRoundedRectRadius));
 
+    if (shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason)) {
+        arrowRect = path.boundingRect();
+        arrowRect.setX(arrowRect.maxX() + replacementArrowLeftMargin);
+        arrowRect.setWidth(arrowRect.height());
+        path.addEllipse(arrowRect);
+        addReplacementArrowPath(path, arrowRect);
+    }
+
     return true;
 }
 
@@ -284,19 +340,20 @@
     FloatRect contentRect;
     Path path;
     FloatRect replacementTextRect;
+    FloatRect arrowRect;
     Font font;
     TextRun run("", 0);
     float textWidth;
-    if (getReplacementTextGeometry(accumulatedOffset, contentRect, path, replacementTextRect, font, run, textWidth))
+    if (getReplacementTextGeometry(accumulatedOffset, contentRect, path, replacementTextRect, arrowRect, font, run, textWidth))
         return LayoutRect(replacementTextRect);
-    
+
     return LayoutRect();
 }
 
 bool RenderEmbeddedObject::isReplacementObscured() const
 {
     // Return whether or not the replacement content for blocked plugins is accessible to the user.
-    
+
     // Check the opacity of each layer containing the element or its ancestors.
     float opacity = 1.0;
     for (RenderLayer* layer = enclosingLayer(); layer; layer = layer->parent()) {
@@ -410,7 +467,7 @@
 
     if (!childBox)
         return;
-    
+
     if (newSize == oldSize && !childBox->needsLayout())
         return;
     
@@ -496,11 +553,12 @@
     FloatRect contentRect;
     Path path;
     FloatRect replacementTextRect;
+    FloatRect arrowRect;
     Font font;
     TextRun run("");
     float textWidth;
-    return getReplacementTextGeometry(IntPoint(), contentRect, path, replacementTextRect, font, run, textWidth)
-        && path.contains(point);
+    return getReplacementTextGeometry(IntPoint(), contentRect, path, replacementTextRect, arrowRect, font, run, textWidth)
+        && (path.contains(point) || arrowRect.contains(point));
 }
 
 bool RenderEmbeddedObject::isInUnavailablePluginIndicator(MouseEvent* event) const
@@ -508,20 +566,14 @@
     return isInUnavailablePluginIndicator(roundedLayoutPoint(absoluteToLocal(event->absoluteLocation(), UseTransforms)));
 }
 
-static bool shouldUnavailablePluginMessageBeButton(Document* document, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
-{
-    Page* page = document->page();
-    return page && page->chrome().client()->shouldUnavailablePluginMessageBeButton(pluginUnavailabilityReason);
-}
-
 void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
 {
     if (!shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason))
         return;
-    
+
     if (!event->isMouseEvent())
         return;
-    
+
     MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
     HTMLPlugInElement* element = toHTMLPlugInElement(node());
     if (event->type() == eventNames().mousedownEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
@@ -534,7 +586,7 @@
             setUnavailablePluginIndicatorIsPressed(true);
         }
         event->setDefaultHandled();
-    }        
+    }
     if (event->type() == eventNames().mouseupEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
         if (m_unavailablePluginIndicatorIsPressed) {
             if (Frame* frame = document()->frame()) {

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (152823 => 152824)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -44,6 +44,7 @@
         InsecurePluginVersion,
     };
     void setPluginUnavailabilityReason(PluginUnavailabilityReason);
+    void setPluginUnavailabilityReasonWithDescription(PluginUnavailabilityReason, const String& description);
     bool showsUnavailablePluginIndicator() const;
 
     // FIXME: This belongs on HTMLObjectElement.
@@ -91,7 +92,7 @@
     void setUnavailablePluginIndicatorIsPressed(bool);
     bool isInUnavailablePluginIndicator(MouseEvent*) const;
     bool isInUnavailablePluginIndicator(const LayoutPoint&) const;
-    bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path&, FloatRect& replacementTextRect, Font&, TextRun&, float& textWidth) const;
+    bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path&, FloatRect& replacementTextRect, FloatRect& arrowRect, Font&, TextRun&, float& textWidth) const;
     LayoutRect replacementTextRect(const LayoutPoint&) const;
 
     virtual bool canHaveChildren() const;
@@ -108,6 +109,7 @@
     bool m_unavailablePluginIndicatorIsPressed;
     bool m_mouseDownWasInUnavailablePluginIndicator;
     RenderObjectChildList m_children;
+    String m_unavailabilityDescription;
 };
 
 inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object)

Modified: trunk/Source/WebKit2/ChangeLog (152823 => 152824)


--- trunk/Source/WebKit2/ChangeLog	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-18 00:43:18 UTC (rev 152824)
@@ -1,3 +1,38 @@
+2013-07-17  Tim Horton  <[email protected]>
+
+        Update blocked/missing plug-in UI
+        https://bugs.webkit.org/show_bug.cgi?id=118347
+        <rdar://problem/14209318>
+
+        Reviewed by Sam Weinig.
+
+        * Platform/CoreIPC/HandleMessage.h:
+        (CoreIPC::callMemberFunction):
+        Add a 6 argument -> 4 reply message handler.
+        (It seems that FindPlugin is getting a little out of hand.)
+
+        * Shared/APIClientTraits.cpp:
+        * Shared/APIClientTraits.h:
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebLoaderClient.cpp:
+        (WebKit::WebLoaderClient::pluginLoadPolicy):
+        * UIProcess/WebLoaderClient.h:
+        Add an unavailability description out-argument to a new version of
+        pluginLoadPolicy, so clients can override the text of the unavailable
+        plugin indicator. Bump the WKPageLoaderClient version and update APIClientTraits.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::findPlugin):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        Plumb the unavailability description through to the WebProcess via
+        the FindPlugin message.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::createPlugin):
+        Acquire the unavailability description from the client
+        (via FindPlugin) and hand it to the RenderEmbeddedObject.
+
 2013-07-17  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r152701, r152703, r152739, r152754,

Modified: trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h (152823 => 152824)


--- trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/Platform/CoreIPC/HandleMessage.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -209,6 +209,12 @@
     (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
 }
 
+template<typename C, typename MF, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R1, typename R2, typename R3, typename R4>
+void callMemberFunction(const Arguments6<P1, P2, P3, P4, P5, P6>& args, Arguments4<R1, R2, R3, R4>& replyArgs, C* object, MF function)
+{
+    (object->*function)(args.argument1, args.argument2, args.argument3, args.argument4, args.argument5, args.argument6, replyArgs.argument1, replyArgs.argument2, replyArgs.argument3, replyArgs.argument4);
+}
+
 // Dispatch functions with delayed reply arguments.
 template<typename C, typename MF, typename R>
 void callMemberFunction(const Arguments0&, PassRefPtr<R> delayedReply, C* object, MF function)

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.cpp (152823 => 152824)


--- trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -66,6 +66,7 @@
 const size_t APIClientTraits<WKPageLoaderClient>::interfaceSizesByVersion[] = {
     offsetof(WKPageLoaderClient, didDetectXSSForFrame),
     offsetof(WKPageLoaderClient, didReceiveIntentForFrame_unavailable),
+    offsetof(WKPageLoaderClient, pluginLoadPolicy),
     sizeof(WKPageLoaderClient)
 };
 

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (152823 => 152824)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -64,7 +64,7 @@
 };
 
 template<> struct APIClientTraits<WKPageLoaderClient> {
-    static const size_t interfaceSizesByVersion[3];
+    static const size_t interfaceSizesByVersion[4];
 };
 
 template<> struct APIClientTraits<WKPageUIClient> {

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -82,12 +82,13 @@
 typedef void (*WKPageDidNewFirstVisuallyNonEmptyLayoutCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageWillGoToBackForwardListItemCallback)(WKPageRef page, WKBackForwardListItemRef item, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageDidLayoutCallback)(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo);
-typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
+typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, WKStringRef* unavailabilityDescription, const void* clientInfo);
 typedef void (*WKPagePluginDidFailCallback)(WKPageRef page, WKErrorCode errorCode, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
 
 // Deprecated
 typedef void (*WKPageDidFailToInitializePluginCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, const void* clientInfo);
 typedef void (*WKPagePluginDidFailCallback_deprecatedForUseWithV1)(WKPageRef page, WKErrorCode errorCode, WKStringRef mimeType, WKStringRef pluginIdentifier, WKStringRef pluginVersion, const void* clientInfo);
+typedef WKPluginLoadPolicy (*WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2)(WKPageRef page, WKPluginLoadPolicy currentPluginLoadPolicy, WKDictionaryRef pluginInfoDictionary, const void* clientInfo);
 
 struct WKPageLoaderClient {
     int                                                                 version;
@@ -139,12 +140,15 @@
     void                                                                (*registerIntentServiceForFrame_unavailable)(void);
 
     WKPageDidLayoutCallback                                             didLayout;
+    WKPagePluginLoadPolicyCallback_deprecatedForUseWithV2                                      pluginLoadPolicy_deprecatedForUseWithV2;
+    WKPagePluginDidFailCallback                                         pluginDidFail;
+
+    // Version 3
     WKPagePluginLoadPolicyCallback                                      pluginLoadPolicy;
-    WKPagePluginDidFailCallback                                         pluginDidFail;
 };
 typedef struct WKPageLoaderClient WKPageLoaderClient;
 
-enum { kWKPageLoaderClientCurrentVersion = 2 };
+enum { kWKPageLoaderClientCurrentVersion = 3 };
 
 // Policy Client.
 typedef void (*WKPageDecidePolicyForNavigationActionCallback)(WKPageRef page, WKFrameRef frame, WKFrameNavigationType navigationType, WKEventModifiers modifiers, WKEventMouseButton mouseButton, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo);

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -319,12 +319,22 @@
             m_client.clientInfo);
 }
 
-PluginModuleLoadPolicy WebLoaderClient::pluginLoadPolicy(WebPageProxy* page, PluginModuleLoadPolicy currentPluginLoadPolicy, ImmutableDictionary* pluginInformation)
+PluginModuleLoadPolicy WebLoaderClient::pluginLoadPolicy(WebPageProxy* page, PluginModuleLoadPolicy currentPluginLoadPolicy, ImmutableDictionary* pluginInformation, String& unavailabilityDescription)
 {
-    if (!m_client.pluginLoadPolicy)
-        return currentPluginLoadPolicy;
+    WKStringRef unavailabilityDescriptionOut = 0;
+    PluginModuleLoadPolicy loadPolicy = currentPluginLoadPolicy;
 
-    return toPluginModuleLoadPolicy(m_client.pluginLoadPolicy(toAPI(page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), m_client.clientInfo));
+    if (m_client.pluginLoadPolicy_deprecatedForUseWithV2)
+        loadPolicy = toPluginModuleLoadPolicy(m_client.pluginLoadPolicy_deprecatedForUseWithV2(toAPI(page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), m_client.clientInfo));
+    else if (m_client.pluginLoadPolicy)
+        loadPolicy = toPluginModuleLoadPolicy(m_client.pluginLoadPolicy(toAPI(page), toWKPluginLoadPolicy(currentPluginLoadPolicy), toAPI(pluginInformation), &unavailabilityDescriptionOut, m_client.clientInfo));
+
+    if (unavailabilityDescriptionOut) {
+        RefPtr<WebString> webUnavailabilityDescription = adoptRef(toImpl(unavailabilityDescriptionOut));
+        unavailabilityDescription = webUnavailabilityDescription->string();
+    }
+    
+    return loadPolicy;
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebLoaderClient.h (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/WebLoaderClient.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -90,7 +90,7 @@
     bool shouldGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*);
     void willGoToBackForwardListItem(WebPageProxy*, WebBackForwardListItem*, APIObject*);
 
-    PluginModuleLoadPolicy pluginLoadPolicy(WebPageProxy*, PluginModuleLoadPolicy currentPluginLoadPolicy, ImmutableDictionary*);
+    PluginModuleLoadPolicy pluginLoadPolicy(WebPageProxy*, PluginModuleLoadPolicy currentPluginLoadPolicy, ImmutableDictionary*, String& unavailabilityDescriptionOutParameter);
     void didFailToInitializePlugin(WebPageProxy*, ImmutableDictionary*);
     void didBlockInsecurePluginVersion(WebPageProxy*, ImmutableDictionary*);
 };

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -1413,7 +1413,7 @@
 }
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy)
+void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription)
 {
     MESSAGE_CHECK_URL(urlString);
 
@@ -1431,7 +1431,7 @@
 
 #if PLATFORM(MAC)
     RefPtr<ImmutableDictionary> pluginInformation = createPluginInformationDictionary(plugin, frameURLString, String(), pageURLString, String(), String());
-    pluginLoadPolicy = m_loaderClient.pluginLoadPolicy(this, static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy), pluginInformation.get());
+    pluginLoadPolicy = m_loaderClient.pluginLoadPolicy(this, static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy), pluginInformation.get(), unavailabilityDescription);
 #else
     UNUSED_PARAM(frameURLString);
     UNUSED_PARAM(pageURLString);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-07-18 00:43:18 UTC (rev 152824)
@@ -1054,7 +1054,7 @@
     void sendWheelEvent(const WebWheelEvent&);
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy);
+    void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription);
 #endif
 
     PageClient* m_pageClient;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (152823 => 152824)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-07-18 00:43:18 UTC (rev 152824)
@@ -319,7 +319,7 @@
 #endif
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-    FindPlugin(WTF::String mimeType, uint32_t processType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString, bool allowOnlyApplicationPlugins) -> (uint64_t pluginProcessToken, WTF::String newMIMEType, uint32_t pluginLoadPolicy)
+    FindPlugin(WTF::String mimeType, uint32_t processType, WTF::String urlString, WTF::String frameURLString, WTF::String pageURLString, bool allowOnlyApplicationPlugins) -> (uint64_t pluginProcessToken, WTF::String newMIMEType, uint32_t pluginLoadPolicy, WTF::String unavailabilityDescription)
 #endif
 
     DidUpdateInWindowState()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (152823 => 152824)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -542,7 +542,8 @@
 
     uint64_t pluginProcessToken;
     uint32_t pluginLoadPolicy;
-    if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, static_cast<uint32_t>(processType), parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy))) {
+    String unavailabilityDescription;
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, static_cast<uint32_t>(processType), parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription))) {
         return 0;
     }
 
@@ -555,7 +556,7 @@
         bool replacementObscured = false;
         if (pluginElement->renderer()->isEmbeddedObject()) {
             RenderEmbeddedObject* renderObject = toRenderEmbeddedObject(pluginElement->renderer());
-            renderObject->setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
+            renderObject->setPluginUnavailabilityReasonWithDescription(RenderEmbeddedObject::InsecurePluginVersion, unavailabilityDescription);
             replacementObscured = renderObject->isReplacementObscured();
         }
 
@@ -3847,7 +3848,8 @@
 
     uint64_t pluginProcessToken;
     String newMIMEType;
-    if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), PluginProcessTypeNormal, response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy)))
+    String unavailabilityDescription;
+    if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), PluginProcessTypeNormal, response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription)))
         return false;
 
     return pluginLoadPolicy != PluginModuleBlocked && pluginProcessToken;

Modified: trunk/Tools/ChangeLog (152823 => 152824)


--- trunk/Tools/ChangeLog	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Tools/ChangeLog	2013-07-18 00:43:18 UTC (rev 152824)
@@ -1,3 +1,17 @@
+2013-07-17  Tim Horton  <[email protected]>
+
+        Update blocked/missing plug-in UI
+        https://bugs.webkit.org/show_bug.cgi?id=118347
+        <rdar://problem/14209318>
+
+        Reviewed by Sam Weinig.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController awakeFromNib]):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createWebViewWithOptions):
+        Match new WKPageLoaderClient entry.
+
 2013-07-17  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r152701, r152703, r152739, r152754,

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (152823 => 152824)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2013-07-18 00:43:18 UTC (rev 152824)
@@ -660,8 +660,9 @@
         0, // didReceiveIntentForFrame
         0, // registerIntentServiceForFrame
         0, // didLayout
+        0, // pluginLoadPolicy_deprecatedForUseWithV2
+        0, // pluginDidFail
         0, // pluginLoadPolicy
-        0, // pluginDidFail
     };
     WKPageSetPageLoaderClient(_webView.pageRef, &loadClient);
     

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (152823 => 152824)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2013-07-18 00:35:30 UTC (rev 152823)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2013-07-18 00:43:18 UTC (rev 152824)
@@ -485,8 +485,9 @@
         0, // didReceiveIntentForFrame
         0, // registerIntentServiceForFrame
         0, // didLayout
+        0, // pluginLoadPolicy_deprecatedForUseWithV2
+        0, // pluginDidFail
         0, // pluginLoadPolicy
-        0, // pluginDidFail
     };
     WKPageSetPageLoaderClient(m_mainWebView->page(), &pageLoaderClient);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to