src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp
changeset 30 5dc02b23752f
parent 23 89e065397ea6
child 33 3e2da88830cd
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
    17     Boston, MA 02110-1301, USA.
    17     Boston, MA 02110-1301, USA.
    18 */
    18 */
    19 #include "config.h"
    19 #include "config.h"
    20 #include "PluginView.h"
    20 #include "PluginView.h"
    21 
    21 
       
    22 #include "Bridge.h"
    22 #include "Document.h"
    23 #include "Document.h"
    23 #include "DocumentLoader.h"
    24 #include "DocumentLoader.h"
    24 #include "Element.h"
    25 #include "Element.h"
    25 #include "FocusController.h"
    26 #include "FocusController.h"
    26 #include "Frame.h"
    27 #include "Frame.h"
    29 #include "FrameTree.h"
    30 #include "FrameTree.h"
    30 #include "FrameView.h"
    31 #include "FrameView.h"
    31 #include "GraphicsContext.h"
    32 #include "GraphicsContext.h"
    32 #include "HTMLNames.h"
    33 #include "HTMLNames.h"
    33 #include "HTMLPlugInElement.h"
    34 #include "HTMLPlugInElement.h"
       
    35 #include "HostWindow.h"
    34 #include "Image.h"
    36 #include "Image.h"
    35 #include "JSDOMBinding.h"
    37 #include "JSDOMBinding.h"
    36 #include "KeyboardEvent.h"
    38 #include "KeyboardEvent.h"
    37 #include "MouseEvent.h"
    39 #include "MouseEvent.h"
    38 #include "NotImplemented.h"
    40 #include "NotImplemented.h"
    39 #include "npfunctions.h"
       
    40 #include "npinterface.h"
       
    41 #include "Page.h"
    41 #include "Page.h"
    42 #include "PlatformKeyboardEvent.h"
    42 #include "PlatformKeyboardEvent.h"
    43 #include "PlatformMouseEvent.h"
    43 #include "PlatformMouseEvent.h"
    44 #include "PluginContainerSymbian.h"
    44 #include "PluginContainerSymbian.h"
    45 #include "PluginDebug.h"
    45 #include "PluginDebug.h"
    46 #include "PluginMainThreadScheduler.h"
    46 #include "PluginMainThreadScheduler.h"
    47 #include "PluginPackage.h"
    47 #include "PluginPackage.h"
       
    48 #include "QWebPageClient.h"
    48 #include "RenderLayer.h"
    49 #include "RenderLayer.h"
    49 #include "ScriptController.h"
    50 #include "ScriptController.h"
    50 #include "Settings.h"
    51 #include "Settings.h"
       
    52 #include "npfunctions.h"
       
    53 #include "npinterface.h"
    51 #include "npruntime_impl.h"
    54 #include "npruntime_impl.h"
    52 #include "runtime.h"
    55 #include "qgraphicswebview.h"
    53 #include "runtime_root.h"
    56 #include "runtime_root.h"
    54 #include "QWebPageClient.h"
       
    55 #include "qgraphicswebview.h"
       
    56 #include <QGraphicsProxyWidget>
    57 #include <QGraphicsProxyWidget>
    57 #include <QKeyEvent>
    58 #include <QKeyEvent>
    58 #include <QPixmap>
    59 #include <QPixmap>
    59 #include <QRegion>
    60 #include <QRegion>
    60 #include <QVector>
    61 #include <QVector>
   307 {
   308 {
   308     notImplemented();
   309     notImplemented();
   309     return NPERR_NO_ERROR;
   310     return NPERR_NO_ERROR;
   310 }
   311 }
   311 
   312 
   312 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
   313 bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
   313 {
   314 {
   314     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
       
   315 
       
   316     switch (variable) {
   315     switch (variable) {
   317     case NPNVjavascriptEnabledBool:
   316     case NPNVjavascriptEnabledBool:
   318         *static_cast<NPBool*>(value) = true;
   317         *static_cast<NPBool*>(value) = true;
   319         return NPERR_NO_ERROR;
   318         *result = NPERR_NO_ERROR;
       
   319         return true;
   320 
   320 
   321     case NPNVSupportsWindowless:
   321     case NPNVSupportsWindowless:
   322         *static_cast<NPBool*>(value) = true;
   322         *static_cast<NPBool*>(value) = true;
   323         return NPERR_NO_ERROR;
   323         *result = NPERR_NO_ERROR;
       
   324         return true;
   324 
   325 
   325     default:
   326     default:
   326         return NPERR_GENERIC_ERROR;
   327         return false;
   327     }
   328     }
   328 }
   329 }
   329 
   330 
   330 NPError PluginView::getValue(NPNVariable variable, void* value)
   331 bool PluginView::platformGetValue(NPNVariable, void*, NPError*)
   331 {
   332 {
   332     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
   333     return false;
   333 
       
   334     switch (variable) {
       
   335     case NPNVWindowNPObject: {
       
   336         if (m_isJavaScriptPaused)
       
   337             return NPERR_GENERIC_ERROR;
       
   338 
       
   339         NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
       
   340 
       
   341         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
       
   342         if (windowScriptObject)
       
   343             _NPN_RetainObject(windowScriptObject);
       
   344 
       
   345         void** v = (void**)value;
       
   346         *v = windowScriptObject;
       
   347             
       
   348         return NPERR_NO_ERROR;
       
   349     }
       
   350 
       
   351     case NPNVPluginElementNPObject: {
       
   352         if (m_isJavaScriptPaused)
       
   353             return NPERR_GENERIC_ERROR;
       
   354 
       
   355         NPObject* pluginScriptObject = 0;
       
   356 
       
   357         if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
       
   358             pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
       
   359 
       
   360         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
       
   361         if (pluginScriptObject)
       
   362             _NPN_RetainObject(pluginScriptObject);
       
   363 
       
   364         void** v = (void**)value;
       
   365         *v = pluginScriptObject;
       
   366 
       
   367         return NPERR_NO_ERROR;
       
   368     }        
       
   369     default:
       
   370         return getValueStatic(variable, value);
       
   371     }
       
   372 }
   334 }
   373 
   335 
   374 void PluginView::invalidateRect(const IntRect& rect)
   336 void PluginView::invalidateRect(const IntRect& rect)
   375 {
   337 {
   376     if (m_isWindowed) {
   338     if (m_isWindowed) {
   450     return true;
   412     return true;
   451 }
   413 }
   452 
   414 
   453 void PluginView::platformDestroy()
   415 void PluginView::platformDestroy()
   454 {
   416 {
   455     if (platformPluginWidget()) { 
   417     if (platformPluginWidget()) {
   456         PluginContainerSymbian* container = static_cast<PluginContainerSymbian*>(platformPluginWidget()); 
   418         PluginContainerSymbian* container = static_cast<PluginContainerSymbian*>(platformPluginWidget());
   457         delete container->proxy(); 
   419         delete container->proxy();
   458         delete container;
   420         delete container;
   459     }
   421     }
   460 }
   422 }
   461 
   423 
   462 void PluginView::halt()
   424 void PluginView::halt()