Changeset 130977 in webkit


Ignore:
Timestamp:
Oct 10, 2012, 4:23:13 PM (13 years ago)
Author:
jonlee@apple.com
Message:

[WK2] Activate plugins when user clicks on snapshot
https://bugs.webkit.org/show_bug.cgi?id=98328
<rdar://problem/12426681>

Reviewed by Brady Eidson.

Source/WebCore:

Extend the default event handler to deal with plugins with snapshots.
When the user clicks on the placeholder, the plugin is recreated and displayed.

  • loader/FrameLoaderClient.h: Add new client function recreatePlugin(), which is

expected to re-create the plugin with the same parameters as when it was run to
obtain the plugin's snapshot placeholder.

  • loader/EmptyClients.cpp: Stub implementation of recreatePlugin().
  • loader/EmptyClients.h:
  • WebCore.exp.in: Expose HTMLPlugInElement::pluginWidget().
  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::defaultEventHandler): Update to look for
RenderSnapshottedPlugIn. If the plugin is not playing, have the renderer handle the
event.

  • rendering/RenderSnapshottedPlugIn.cpp:

(WebCore::RenderSnapshottedPlugin::getCursor): Set to hand cursor when the plugin is not
playing.
(WebCore::RenderSnapshottedPlugIn::handleEvent): If the user clicked on the plugin using the
left button, update the state of the element to playing. Recreate the plugin if the widget exists
to begin with. The cached snapshot image will be saved for possible reuse on back/forward navigation.

  • rendering/RenderSnapshottedPlugIn.h:

(RenderSnapshottedPlugIn):

Source/WebKit/chromium:

  • src/FrameLoaderClientImpl.h:

(WebKit::FrameLoaderClientImpl::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/efl:

  • WebCoreSupport/FrameLoaderClientEfl.h:

(WebCore::FrameLoaderClientEfl::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/gtk:

  • WebCoreSupport/FrameLoaderClientGtk.h:

(WebKit::FrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/mac:

  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/qt:

  • WebCoreSupport/FrameLoaderClientQt.h:

(WebCore::FrameLoaderClientQt::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/win:

  • WebCoreSupport/WebFrameLoaderClient.h:

(WebFrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit/wince:

  • WebCoreSupport/FrameLoaderClientWinCE.h:

(WebKit::FrameLoaderClientWinCE::recreatePlugin): Stub implementation of recreatePlugin().

Source/WebKit2:

Implement the recreation of the plugin.

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::recreateAndInitialize): We can run into a situation where the user
decided to run the plugin before the snapshot was ready to be taken. In this case, the
plugin member variable is non-null, and the timer is still active. Turn off the timer, and
destroy that instance of the plugin. We set the plugin to the instance provided in the
first parameter to this function, and reset the member variables so that the PluginView is
in a state similar to when it was first created. We also immediately initialize the plugin,
which may happen synchronously or asynchronously.

  • WebProcess/Plugins/PluginView.h:

(WebKit::PluginView::initialParameters): Expose the initial parameters. Used to recreate
the plugin.
(WebKit::PluginView::pluginElement): Expose the element associated with the widget. Used to
recreate the plugin.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::recreatePlugin): Create a new Plugin instance using the same
parameters used to create the plugin for snapshotting. Forward that instance to the widget.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

(WebFrameLoaderClient): Implement recreatePlugin().

Location:
trunk/Source
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r130968 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        Extend the default event handler to deal with plugins with snapshots.
     10        When the user clicks on the placeholder, the plugin is recreated and displayed.
     11
     12        * loader/FrameLoaderClient.h: Add new client function recreatePlugin(), which is
     13        expected to re-create the plugin with the same parameters as when it was run to
     14        obtain the plugin's snapshot placeholder.
     15
     16        * loader/EmptyClients.cpp: Stub implementation of recreatePlugin().
     17        * loader/EmptyClients.h:
     18        * WebCore.exp.in: Expose HTMLPlugInElement::pluginWidget().
     19
     20        * html/HTMLPlugInElement.cpp:
     21        (WebCore::HTMLPlugInElement::defaultEventHandler): Update to look for
     22        RenderSnapshottedPlugIn. If the plugin is not playing, have the renderer handle the
     23        event.
     24
     25        * rendering/RenderSnapshottedPlugIn.cpp:
     26        (WebCore::RenderSnapshottedPlugin::getCursor): Set to hand cursor when the plugin is not
     27        playing.
     28        (WebCore::RenderSnapshottedPlugIn::handleEvent): If the user clicked on the plugin using the
     29        left button, update the state of the element to playing. Recreate the plugin if the widget exists
     30        to begin with. The cached snapshot image will be saved for possible reuse on back/forward navigation.
     31        * rendering/RenderSnapshottedPlugIn.h:
     32        (RenderSnapshottedPlugIn):
     33
    1342012-10-10  Kenichi Ishibashi  <bashi@chromium.org>
    235
  • trunk/Source/WebCore/WebCore.exp.in

    r130947 r130977  
    12341234__ZNK7WebCore16VisibleSelection23isContentRichlyEditableEv
    12351235__ZNK7WebCore16VisibleSelection5isAllENS_27EditingBoundaryCrossingRuleE
     1236__ZNK7WebCore17HTMLPlugInElement12pluginWidgetEv
    12361237__ZNK7WebCore17JSDOMGlobalObject22scriptExecutionContextEv
    12371238__ZNK7WebCore17RegularExpression13matchedLengthEv
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r130688 r130977  
    3636#include "PluginViewBase.h"
    3737#include "RenderEmbeddedObject.h"
     38#include "RenderSnapshottedPlugIn.h"
    3839#include "RenderWidget.h"
    3940#include "Settings.h"
     
    178179
    179180    RenderObject* r = renderer();
    180     if (r && r->isEmbeddedObject() && toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) {
    181         toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event);
    182         return;
     181    if (r && r->isEmbeddedObject()) {
     182        if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) {
     183            toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event);
     184            return;
     185        }
     186        if (r->isSnapshottedPlugIn() && displayState() < Playing) {
     187            toRenderSnapshottedPlugIn(r)->handleEvent(event);
     188            return;
     189        }
    183190    }
    184191
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r127558 r130977  
    11/*
    22 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
    3  * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
     3 * Copyright (C) 2008, 2009, 2012 Apple Inc. All rights reserved.
    44 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
    55 *
     
    147147}
    148148
     149void EmptyFrameLoaderClient::recreatePlugin(Widget*)
     150{
     151}
     152
    149153PassRefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&)
    150154{
  • trunk/Source/WebCore/loader/EmptyClients.h

    r130400 r130977  
    11/*
    22 * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
    3  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
     3 * Copyright (C) 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
    44 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    55 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
     
    345345    virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) OVERRIDE;
    346346    virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) OVERRIDE;
     347    virtual void recreatePlugin(Widget*) OVERRIDE;
    347348    virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) OVERRIDE;
    348349#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r130270 r130977  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
    33 * Copyright (C) 2012 Google Inc. All rights reserved.
    44 *
     
    263263        virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) = 0;
    264264        virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
     265        virtual void recreatePlugin(Widget*) = 0;
    265266        virtual void redirectDataToPlugin(Widget* pluginWidget) = 0;
    266267
  • trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp

    r130810 r130977  
    2828
    2929#include "Cursor.h"
     30#include "FrameLoaderClient.h"
    3031#include "FrameView.h"
    3132#include "Gradient.h"
    3233#include "HTMLPlugInImageElement.h"
     34#include "MouseEvent.h"
    3335#include "PaintInfo.h"
    3436#include "Path.h"
     
    116118}
    117119
     120CursorDirective RenderSnapshottedPlugIn::getCursor(const LayoutPoint& point, Cursor& overrideCursor) const
     121{
     122    if (plugInImageElement()->displayState() < HTMLPlugInElement::Playing) {
     123        overrideCursor = handCursor();
     124        return SetCursor;
     125    }
     126    return RenderEmbeddedObject::getCursor(point, overrideCursor);
     127}
     128
     129void RenderSnapshottedPlugIn::handleEvent(Event* event)
     130{
     131    if (!event->isMouseEvent())
     132        return;
     133
     134    MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
     135    if (event->type() == eventNames().clickEvent && mouseEvent->button() == LeftButton) {
     136        plugInImageElement()->setDisplayState(HTMLPlugInElement::Playing);
     137        if (widget()) {
     138            if (Frame* frame = document()->frame())
     139                frame->loader()->client()->recreatePlugin(widget());
     140            repaint();
     141        }
     142        event->setDefaultHandled();
     143    }
     144}
     145
    118146} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h

    r130810 r130977  
    4343    void updateSnapshot(PassRefPtr<Image>);
    4444
     45    void handleEvent(Event*);
     46
    4547private:
    4648    HTMLPlugInImageElement* plugInImageElement() const;
    4749    virtual const char* renderName() const { return "RenderSnapshottedPlugIn"; }
    4850
     51    virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const OVERRIDE;
    4952    virtual bool isSnapshottedPlugIn() const OVERRIDE { return true; }
    5053    virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
  • trunk/Source/WebKit/chromium/ChangeLog

    r130950 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * src/FrameLoaderClientImpl.h:
     10        (WebKit::FrameLoaderClientImpl::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-10  David Barton  <dbarton@mathscribe.com>
    213
  • trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h

    r130270 r130977  
    183183        const Vector<WTF::String>&, const Vector<WTF::String>&,
    184184        const WTF::String&, bool loadManually);
     185    virtual void recreatePlugin(WebCore::Widget*) { }
    185186    virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
    186187    virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(
  • trunk/Source/WebKit/efl/ChangeLog

    r130881 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/FrameLoaderClientEfl.h:
     10        (WebCore::FrameLoaderClientEfl::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-10  Ryuan Choi  <ryuan.choi@samsung.com>
    213
  • trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h

    r129545 r130977  
    133133
    134134    virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const WTF::Vector<String>&, const WTF::Vector<String>&, const String&, bool);
     135    virtual void recreatePlugin(Widget*) { }
    135136    virtual void redirectDataToPlugin(Widget* pluginWidget);
    136137    virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const WTF::Vector<String>& paramNames, const WTF::Vector<String>& paramValues);
  • trunk/Source/WebKit/gtk/ChangeLog

    r130867 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/FrameLoaderClientGtk.h:
     10        (WebKit::FrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-10  Sheriff Bot  <webkit.review.bot@gmail.com>
    213
  • trunk/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h

    r129545 r130977  
    115115                                   const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
    116116        virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WTF::String>&, const WTF::Vector<WTF::String>&, const WTF::String&, bool);
     117        virtual void recreatePlugin(WebCore::Widget*) { }
    117118        virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
    118119        virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues);
  • trunk/Source/WebKit/mac/ChangeLog

    r130947 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/WebFrameLoaderClient.h:
     10        * WebCoreSupport/WebFrameLoaderClient.mm:
     11        (WebFrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().
     12
    1132012-10-10  Brady Eidson  <beidson@apple.com>
    214
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h

    r129964 r130977  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    199199    virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&,
    200200                                          const Vector<WTF::String>&, const WTF::String&, bool) OVERRIDE;
     201    virtual void recreatePlugin(WebCore::Widget*) OVERRIDE;
    201202    virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) OVERRIDE;
    202203   
  • trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r129964 r130977  
    11/*
    2  * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    17251725}
    17261726
     1727void WebFrameLoaderClient::recreatePlugin(Widget*)
     1728{
     1729}
     1730
    17271731void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
    17281732{
  • trunk/Source/WebKit/qt/ChangeLog

    r130898 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/FrameLoaderClientQt.h:
     10        (WebCore::FrameLoaderClientQt::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-10  Balazs Kelemen  <kbalazs@webkit.org>
    213
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h

    r129545 r130977  
    208208                               const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
    209209    virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
     210    virtual void recreatePlugin(Widget*) { }
    210211    virtual void redirectDataToPlugin(Widget* pluginWidget);
    211212
  • trunk/Source/WebKit/win/ChangeLog

    r130947 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/WebFrameLoaderClient.h:
     10        (WebFrameLoaderClient::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-10  Brady Eidson  <beidson@apple.com>
    213
  • trunk/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h

    r129545 r130977  
    116116                               const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
    117117    virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually);
     118    virtual void recreatePlugin(WebCore::Widget*) { }
    118119    virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
    119120
  • trunk/Source/WebKit/wince/ChangeLog

    r130612 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        * WebCoreSupport/FrameLoaderClientWinCE.h:
     10        (WebKit::FrameLoaderClientWinCE::recreatePlugin): Stub implementation of recreatePlugin().
     11
    1122012-10-07  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    213
  • trunk/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h

    r129545 r130977  
    109109                               const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
    110110    virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WTF::String>&, const WTF::Vector<WTF::String>&, const WTF::String&, bool);
     111    virtual void recreatePlugin(WebCore::Widget*) { }
    111112    virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
    112113    virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const WTF::Vector<WTF::String>& paramNames, const WTF::Vector<WTF::String>& paramValues);
  • trunk/Source/WebKit2/ChangeLog

    r130973 r130977  
     12012-10-10  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Activate plugins when user clicks on snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=98328
     5        <rdar://problem/12426681>
     6
     7        Reviewed by Brady Eidson.
     8
     9        Implement the recreation of the plugin.
     10
     11        * WebProcess/Plugins/PluginView.cpp:
     12        (WebKit::PluginView::recreateAndInitialize): We can run into a situation where the user
     13        decided to run the plugin before the snapshot was ready to be taken. In this case, the
     14        plugin member variable is non-null, and the timer is still active. Turn off the timer, and
     15        destroy that instance of the plugin. We set the plugin to the instance provided in the
     16        first parameter to this function, and reset the member variables so that the PluginView is
     17        in a state similar to when it was first created. We also immediately initialize the plugin,
     18        which may happen synchronously or asynchronously.
     19
     20        * WebProcess/Plugins/PluginView.h:
     21        (WebKit::PluginView::initialParameters): Expose the initial parameters. Used to recreate
     22        the plugin.
     23        (WebKit::PluginView::pluginElement): Expose the element associated with the widget. Used to
     24        recreate the plugin.
     25
     26        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     27        (WebKit::WebFrameLoaderClient::recreatePlugin): Create a new Plugin instance using the same
     28        parameters used to create the plugin for snapshotting. Forward that instance to the widget.
     29        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     30        (WebFrameLoaderClient): Implement recreatePlugin().
     31
    1322012-10-10  Sam Weinig  <sam@webkit.org>
    233
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r130810 r130977  
    317317}
    318318
     319void PluginView::recreateAndInitialize(PassRefPtr<Plugin> plugin)
     320{
     321    if (m_plugin) {
     322        if (m_pluginSnapshotTimer.isActive())
     323            m_pluginSnapshotTimer.stop();
     324        destroyPluginAndReset();
     325    }
     326
     327    // Reset member variables to initial values.
     328    m_plugin = plugin;
     329    m_isInitialized = false;
     330    m_isWaitingForSynchronousInitialization = false;
     331    m_isWaitingUntilMediaCanStart = false;
     332    m_isBeingDestroyed = false;
     333    m_manualStreamState = StreamStateInitial;
     334    m_transientPaintingSnapshot = nullptr;
     335
     336    initializePlugin();
     337}
     338
    319339Frame* PluginView::frame() const
    320340{
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h

    r130810 r130977  
    5454    static PassRefPtr<PluginView> create(PassRefPtr<WebCore::HTMLPlugInElement>, PassRefPtr<Plugin>, const Plugin::Parameters&);
    5555
     56    void recreateAndInitialize(PassRefPtr<Plugin>);
     57
    5658    WebCore::Frame* frame() const;
    5759
     
    7274    RetainPtr<PDFDocument> pdfDocumentForPrinting() const { return m_plugin->pdfDocumentForPrinting(); }
    7375#endif
     76
     77    WebCore::HTMLPlugInElement* pluginElement() const { return m_pluginElement.get(); }
     78    const Plugin::Parameters& initialParameters() const { return m_parameters; }
    7479
    7580    // FIXME: Remove this; nobody should have to know about the plug-in view's renderer except the plug-in view itself.
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r130029 r130977  
    11/*
    2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    13541354}
    13551355
     1356void WebFrameLoaderClient::recreatePlugin(Widget* widget)
     1357{
     1358    ASSERT(widget && widget->isPluginViewBase());
     1359    ASSERT(m_frame->page());
     1360
     1361    PluginView* pluginView = static_cast<PluginView*>(widget);
     1362    RefPtr<Plugin> plugin = m_frame->page()->createPlugin(m_frame, pluginView->pluginElement(), pluginView->initialParameters());
     1363    pluginView->recreateAndInitialize(plugin.release());
     1364}
     1365
    13561366void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
    13571367{
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r130029 r130977  
    11/*
    2  * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    189189   
    190190    virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) OVERRIDE;
     191    virtual void recreatePlugin(WebCore::Widget*) OVERRIDE;
    191192    virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget) OVERRIDE;
    192193   
Note: See TracChangeset for help on using the changeset viewer.