diff options
Diffstat (limited to 'WebCore/plugins/PluginView.h')
| -rw-r--r-- | WebCore/plugins/PluginView.h | 72 |
1 files changed, 56 insertions, 16 deletions
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h index 5c39535..a5618f7 100644 --- a/WebCore/plugins/PluginView.h +++ b/WebCore/plugins/PluginView.h @@ -2,6 +2,7 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Collabora Ltd. All rights reserved. + * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,6 +31,7 @@ #include "CString.h" #include "FrameLoadRequest.h" +#include "HaltablePlugin.h" #include "IntRect.h" #include "KURL.h" #include "PlatformString.h" @@ -49,13 +51,16 @@ #include "PluginTimer.h" #endif -#if PLATFORM(WIN_OS) && PLATFORM(QT) +#if PLATFORM(WIN_OS) && (PLATFORM(QT) || PLATFORM(WX)) typedef struct HWND__* HWND; typedef HWND PlatformPluginWidget; #elif defined(ANDROID_PLUGINS) typedef struct PluginWidgetAndroid* PlatformPluginWidget; #else typedef PlatformWidget PlatformPluginWidget; +#if defined(XP_MACOSX) && PLATFORM(QT) +#include <QPixmap> +#endif #endif #if USE(JSC) @@ -71,13 +76,14 @@ class NPObject; namespace WebCore { class Element; class Frame; + class Image; class KeyboardEvent; class MouseEvent; #ifdef ANDROID_PLUGINS class TouchEvent; #endif class KURL; -#if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) +#if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) class PluginMessageThrottlerWin; #endif class PluginPackage; @@ -92,7 +98,7 @@ namespace WebCore { PluginStatusLoadedSuccessfully }; - class PluginRequest { + class PluginRequest : public Noncopyable { public: PluginRequest(const FrameLoadRequest& frameLoadRequest, bool sendNotification, void* notifyData, bool shouldAllowPopups) : m_frameLoadRequest(frameLoadRequest) @@ -120,7 +126,7 @@ namespace WebCore { virtual void didFail(const ResourceError&) = 0; }; - class PluginView : public Widget, private PluginStreamClient, public PluginManualLoader { + class PluginView : public Widget, private PluginStreamClient, public PluginManualLoader, private HaltablePlugin { public: static PassRefPtr<PluginView> create(Frame* parentFrame, const IntSize&, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually); virtual ~PluginView(); @@ -204,7 +210,7 @@ namespace WebCore { const String& mimeType() const { return m_mimeType; } const KURL& url() const { return m_url; } -#if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) +#if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) static LRESULT CALLBACK PluginViewWndProc(HWND, UINT, WPARAM, LPARAM); LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); WNDPROC pluginWndProc() const { return m_pluginWndProc; } @@ -216,6 +222,16 @@ namespace WebCore { void didFinishLoading(); void didFail(const ResourceError&); + // HaltablePlugin + virtual void halt(); + virtual void restart(); + virtual Node* node() const; + virtual bool isWindowed() const { return m_isWindowed; } + virtual String pluginName() const; + + bool isHalted() const { return m_isHalted; } + bool hasBeenHalted() const { return m_hasBeenHalted; } + static bool isCallingPlugin(); #ifdef ANDROID_PLUGINS @@ -232,8 +248,9 @@ namespace WebCore { bool startOrAddToUnstartedList(); void removeFromUnstartedListIfNecessary(); void init(); - void platformStart(); + bool platformStart(); void stop(); + void platformDestroy(); static void setCurrentPluginView(PluginView*); NPError load(const FrameLoadRequest&, bool sendNotification, void* notifyData); NPError handlePost(const char* url, const char* target, uint32 len, const char* buf, bool file, void* notifyData, bool sendNotification, bool allowHeaders); @@ -243,8 +260,8 @@ namespace WebCore { void invalidateWindowlessPluginRect(const IntRect&); -#if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) - void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&) const; +#if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) + void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&); static HDC WINAPI hookedBeginPaint(HWND, PAINTSTRUCT*); static BOOL WINAPI hookedEndPaint(HWND, const PAINTSTRUCT*); #endif @@ -276,8 +293,18 @@ namespace WebCore { void handleKeyboardEvent(KeyboardEvent*); void handleMouseEvent(MouseEvent*); +#if defined(Q_WS_X11) && ENABLE(NETSCAPE_PLUGIN_API) + void handleFocusInEvent(); + void handleFocusOutEvent(); +#endif + +#if PLATFORM(WIN_OS) + void paintIntoTransformedContext(HDC); + PassRefPtr<Image> snapshot(); +#endif #ifdef ANDROID_PLUGINS + void handleFocusEvent(bool hasFocus); void handleTouchEvent(TouchEvent*); // called at the end of the base constructor void platformInit(); @@ -299,7 +326,7 @@ namespace WebCore { NPP m_instance; NPP_t m_instanceStruct; NPWindow m_npWindow; - + Vector<bool, 4> m_popupStateStack; HashSet<RefPtr<PluginStream> > m_streams; @@ -310,11 +337,11 @@ namespace WebCore { bool m_haveInitialized; bool m_isWaitingToStart; -#if PLATFORM(GTK) || defined(Q_WS_X11) +#if defined(XP_UNIX) || defined(Q_WS_X11) bool m_needsXEmbed; #endif -#if PLATFORM(WIN_OS) && !PLATFORM(WX) && ENABLE(NETSCAPE_PLUGIN_API) +#if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) OwnPtr<PluginMessageThrottlerWin> m_messageThrottler; WNDPROC m_pluginWndProc; unsigned m_lastMessage; @@ -327,7 +354,7 @@ namespace WebCore { PluginTimerList m_timerList; #endif -#if (PLATFORM(QT) && PLATFORM(WIN_OS)) || defined(XP_MACOSX) +#if ((PLATFORM(QT) || PLATFORM(WX)) && PLATFORM(WIN_OS)) || defined(XP_MACOSX) // On Mac OSX and Qt/Windows the plugin does not have its own native widget, // but is using the containing window as its reference for positioning/painting. PlatformPluginWidget m_window; @@ -340,26 +367,36 @@ public: PlatformPluginWidget platformPluginWidget() const { return m_window; } // MANUAL MERGE FIXME #else public: + void setPlatformPluginWidget(PlatformPluginWidget widget) { setPlatformWidget(widget); } PlatformPluginWidget platformPluginWidget() const { return platformWidget(); } #endif private: -#if PLATFORM(GTK) || defined(Q_WS_X11) +#if defined(XP_UNIX) || defined(Q_WS_X11) || PLATFORM(SYMBIAN) void setNPWindowIfNeeded(); #elif defined(XP_MACOSX) NP_CGContext m_npCgContext; - OwnPtr<Timer<PluginView> > m_nullEventTimer; NPDrawingModel m_drawingModel; NPEventModel m_eventModel; + CGContextRef m_contextRef; + WindowRef m_fakeWindow; +#if PLATFORM(QT) + QPixmap m_pixmap; +#endif void setNPWindowIfNeeded(); - void nullEventTimerFired(Timer<PluginView>*); Point globalMousePosForPlugin() const; #endif -#if defined(Q_WS_X11) +#if defined(Q_WS_X11) && ENABLE(NETSCAPE_PLUGIN_API) bool m_hasPendingGeometryChange; + Pixmap m_drawable; + Visual* m_visual; + Colormap m_colormap; + Display* m_pluginDisplay; + + void initXEvent(XEvent* event); #endif IntRect m_clipRect; // The clip rect to apply to a windowed plug-in @@ -370,6 +407,9 @@ private: bool m_isJavaScriptPaused; + bool m_isHalted; + bool m_hasBeenHalted; + static PluginView* s_currentPluginView; }; |
