| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_ | |
| 6 #define WEBKIT_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_ | |
| 7 | |
| 8 #include "build/build_config.h" | |
| 9 | |
| 10 #include <string> | |
| 11 #include <list> | |
| 12 | |
| 13 #include "base/ref_counted.h" | |
| 14 #include "base/scoped_ptr.h" | |
| 15 #include "base/task.h" | |
| 16 #include "base/time.h" | |
| 17 #include "base/timer.h" | |
| 18 #include "gfx/native_widget_types.h" | |
| 19 #include "gfx/rect.h" | |
| 20 #include "third_party/npapi/bindings/npapi.h" | |
| 21 #include "webkit/glue/plugins/webplugin_delegate.h" | |
| 22 #include "webkit/glue/webcursor.h" | |
| 23 | |
| 24 #if defined(USE_X11) | |
| 25 #include "app/x11_util.h" | |
| 26 | |
| 27 typedef struct _GdkDrawable GdkPixmap; | |
| 28 #endif | |
| 29 | |
| 30 class FilePath; | |
| 31 | |
| 32 namespace NPAPI { | |
| 33 class PluginInstance; | |
| 34 } | |
| 35 | |
| 36 namespace WebKit { | |
| 37 class WebMouseEvent; | |
| 38 } | |
| 39 | |
| 40 #if defined(OS_MACOSX) | |
| 41 class ExternalDragTracker; | |
| 42 #ifndef NP_NO_QUICKDRAW | |
| 43 class QuickDrawDrawingManager; | |
| 44 #endif | |
| 45 #ifdef __OBJC__ | |
| 46 @class CALayer; | |
| 47 @class CARenderer; | |
| 48 #else | |
| 49 class CALayer; | |
| 50 class CARenderer; | |
| 51 #endif | |
| 52 namespace webkit_glue { | |
| 53 class WebPluginAcceleratedSurface; | |
| 54 } | |
| 55 #endif | |
| 56 | |
| 57 // An implementation of WebPluginDelegate that runs in the plugin process, | |
| 58 // proxied from the renderer by WebPluginDelegateProxy. | |
| 59 class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { | |
| 60 public: | |
| 61 enum PluginQuirks { | |
| 62 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 | |
| 63 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 | |
| 64 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 | |
| 65 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 | |
| 66 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 | |
| 67 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 | |
| 68 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 | |
| 69 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 | |
| 70 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux | |
| 71 PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux | |
| 72 PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows | |
| 73 PLUGIN_QUIRK_PATCH_REGENUMKEYEXW = 2048, // Windows | |
| 74 PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS = 4096, // Windows | |
| 75 PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH = 8192, // Mac | |
| 76 PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE = 16384, // Windows | |
| 77 PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK = 32768, // Linux | |
| 78 PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL = 65536, // Windows. | |
| 79 }; | |
| 80 | |
| 81 static WebPluginDelegateImpl* Create(const FilePath& filename, | |
| 82 const std::string& mime_type, | |
| 83 gfx::PluginWindowHandle containing_view); | |
| 84 | |
| 85 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | |
| 86 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | |
| 87 std::wstring *plugin_name); | |
| 88 | |
| 89 // Returns true if the window handle passed in is that of the dummy | |
| 90 // activation window for windowless plugins. | |
| 91 static bool IsDummyActivationWindow(gfx::NativeWindow window); | |
| 92 | |
| 93 // WebPluginDelegate implementation | |
| 94 virtual bool Initialize(const GURL& url, | |
| 95 const std::vector<std::string>& arg_names, | |
| 96 const std::vector<std::string>& arg_values, | |
| 97 webkit_glue::WebPlugin* plugin, | |
| 98 bool load_manually); | |
| 99 virtual void PluginDestroyed(); | |
| 100 virtual void UpdateGeometry(const gfx::Rect& window_rect, | |
| 101 const gfx::Rect& clip_rect); | |
| 102 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); | |
| 103 virtual void Print(gfx::NativeDrawingContext context); | |
| 104 virtual void SetFocus(bool focused); | |
| 105 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | |
| 106 WebKit::WebCursorInfo* cursor_info); | |
| 107 virtual NPObject* GetPluginScriptableObject(); | |
| 108 virtual void DidFinishLoadWithReason( | |
| 109 const GURL& url, NPReason reason, int notify_id); | |
| 110 virtual int GetProcessId(); | |
| 111 virtual void SendJavaScriptStream(const GURL& url, | |
| 112 const std::string& result, | |
| 113 bool success, | |
| 114 int notify_id); | |
| 115 virtual void DidReceiveManualResponse(const GURL& url, | |
| 116 const std::string& mime_type, | |
| 117 const std::string& headers, | |
| 118 uint32 expected_length, | |
| 119 uint32 last_modified); | |
| 120 virtual void DidReceiveManualData(const char* buffer, int length); | |
| 121 virtual void DidFinishManualLoading(); | |
| 122 virtual void DidManualLoadFail(); | |
| 123 virtual void InstallMissingPlugin(); | |
| 124 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( | |
| 125 unsigned long resource_id, const GURL& url, int notify_id); | |
| 126 virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient( | |
| 127 unsigned long resource_id, int range_request_id); | |
| 128 // End of WebPluginDelegate implementation. | |
| 129 | |
| 130 bool IsWindowless() const { return windowless_ ; } | |
| 131 gfx::Rect GetRect() const { return window_rect_; } | |
| 132 gfx::Rect GetClipRect() const { return clip_rect_; } | |
| 133 | |
| 134 // Returns the path for the library implementing this plugin. | |
| 135 FilePath GetPluginPath(); | |
| 136 | |
| 137 // Returns a combination of PluginQuirks. | |
| 138 int GetQuirks() const { return quirks_; } | |
| 139 | |
| 140 // Informs the plugin that the view it is in has gained or lost focus. | |
| 141 void SetContentAreaHasFocus(bool has_focus); | |
| 142 | |
| 143 #if defined(OS_MACOSX) | |
| 144 // Informs the plugin that the geometry has changed, as with UpdateGeometry, | |
| 145 // but also includes the new buffer context for that new geometry. | |
| 146 void UpdateGeometryAndContext(const gfx::Rect& window_rect, | |
| 147 const gfx::Rect& clip_rect, | |
| 148 gfx::NativeDrawingContext context); | |
| 149 // Informs the delegate that the plugin called NPN_Invalidate*. Used as a | |
| 150 // trigger for Core Animation drawing. | |
| 151 void PluginDidInvalidate(); | |
| 152 // Returns the delegate currently processing events. | |
| 153 static WebPluginDelegateImpl* GetActiveDelegate(); | |
| 154 // Informs the plugin that the window it is in has gained or lost focus. | |
| 155 void SetWindowHasFocus(bool has_focus); | |
| 156 // Returns whether or not the window the plugin is in has focus. | |
| 157 bool GetWindowHasFocus() const { return containing_window_has_focus_; } | |
| 158 // Informs the plugin that its tab or window has been hidden or shown. | |
| 159 void SetContainerVisibility(bool is_visible); | |
| 160 // Informs the plugin that its containing window's frame has changed. | |
| 161 // Frames are in screen coordinates. | |
| 162 void WindowFrameChanged(const gfx::Rect& window_frame, | |
| 163 const gfx::Rect& view_frame); | |
| 164 // Informs the plugin that IME composition has been confirmed. | |
| 165 void ImeCompositionConfirmed(const string16& text); | |
| 166 // Informs the delegate that the plugin set a Carbon ThemeCursor. | |
| 167 void SetThemeCursor(ThemeCursor cursor); | |
| 168 // Informs the delegate that the plugin set a Carbon Cursor. | |
| 169 void SetCursor(const Cursor* cursor); | |
| 170 // Informs the delegate that the plugin set a Cocoa NSCursor. | |
| 171 void SetNSCursor(NSCursor* cursor); | |
| 172 | |
| 173 #ifndef NP_NO_CARBON | |
| 174 // Indicates that it's time to send the plugin a null event. | |
| 175 void FireIdleEvent(); | |
| 176 #endif | |
| 177 #endif // OS_MACOSX | |
| 178 | |
| 179 gfx::PluginWindowHandle windowed_handle() const { | |
| 180 return windowed_handle_; | |
| 181 } | |
| 182 | |
| 183 #if defined(OS_MACOSX) | |
| 184 // Allow setting a "fake" window handle to associate this plug-in with | |
| 185 // an IOSurface in the browser. Used for accelerated drawing surfaces. | |
| 186 void set_windowed_handle(gfx::PluginWindowHandle handle); | |
| 187 #endif | |
| 188 | |
| 189 #if defined(USE_X11) | |
| 190 void SetWindowlessShmPixmap(XID shm_pixmap) { | |
| 191 windowless_shm_pixmap_ = shm_pixmap; | |
| 192 } | |
| 193 #endif | |
| 194 | |
| 195 private: | |
| 196 friend class DeleteTask<WebPluginDelegateImpl>; | |
| 197 friend class webkit_glue::WebPluginDelegate; | |
| 198 | |
| 199 WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view, | |
| 200 NPAPI::PluginInstance *instance); | |
| 201 ~WebPluginDelegateImpl(); | |
| 202 | |
| 203 // Called by Initialize() for platform-specific initialization. | |
| 204 // If this returns false, the plugin shouldn't be started--see Initialize(). | |
| 205 bool PlatformInitialize(); | |
| 206 | |
| 207 // Called by DestroyInstance(), used for platform-specific destruction. | |
| 208 void PlatformDestroyInstance(); | |
| 209 | |
| 210 //-------------------------- | |
| 211 // used for windowed plugins | |
| 212 void WindowedUpdateGeometry(const gfx::Rect& window_rect, | |
| 213 const gfx::Rect& clip_rect); | |
| 214 // Create the native window. | |
| 215 // Returns true if the window is created (or already exists). | |
| 216 // Returns false if unable to create the window. | |
| 217 bool WindowedCreatePlugin(); | |
| 218 | |
| 219 // Destroy the native window. | |
| 220 void WindowedDestroyWindow(); | |
| 221 | |
| 222 // Reposition the native window to be in sync with the given geometry. | |
| 223 // Returns true if the native window has moved or been clipped differently. | |
| 224 bool WindowedReposition(const gfx::Rect& window_rect, | |
| 225 const gfx::Rect& clip_rect); | |
| 226 | |
| 227 // Tells the plugin about the current state of the window. | |
| 228 // See NPAPI NPP_SetWindow for more information. | |
| 229 void WindowedSetWindow(); | |
| 230 | |
| 231 #if defined(OS_WIN) | |
| 232 // Registers the window class for our window | |
| 233 ATOM RegisterNativeWindowClass(); | |
| 234 | |
| 235 // Our WndProc functions. | |
| 236 static LRESULT CALLBACK DummyWindowProc( | |
| 237 HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); | |
| 238 static LRESULT CALLBACK NativeWndProc( | |
| 239 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | |
| 240 static LRESULT CALLBACK FlashWindowlessWndProc( | |
| 241 HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); | |
| 242 | |
| 243 // Used for throttling Flash messages. | |
| 244 static void ClearThrottleQueueForWindow(HWND window); | |
| 245 static void OnThrottleMessage(); | |
| 246 static void ThrottleMessage(WNDPROC proc, HWND hwnd, UINT message, | |
| 247 WPARAM wParam, LPARAM lParam); | |
| 248 #endif | |
| 249 | |
| 250 //---------------------------- | |
| 251 // used for windowless plugins | |
| 252 void WindowlessUpdateGeometry(const gfx::Rect& window_rect, | |
| 253 const gfx::Rect& clip_rect); | |
| 254 void WindowlessPaint(gfx::NativeDrawingContext hdc, const gfx::Rect& rect); | |
| 255 | |
| 256 // Tells the plugin about the current state of the window. | |
| 257 // See NPAPI NPP_SetWindow for more information. | |
| 258 void WindowlessSetWindow(); | |
| 259 | |
| 260 // Informs the plugin that it has gained or lost keyboard focus (on the Mac, | |
| 261 // this just means window first responder status). | |
| 262 void SetPluginHasFocus(bool focused); | |
| 263 | |
| 264 // Handles the platform specific details of setting plugin focus. Returns | |
| 265 // false if the platform cancelled the focus tranfer. | |
| 266 bool PlatformSetPluginHasFocus(bool focused); | |
| 267 | |
| 268 //----------------------------------------- | |
| 269 // used for windowed and windowless plugins | |
| 270 | |
| 271 // Does platform-specific event handling. Arguments and return are identical | |
| 272 // to HandleInputEvent. | |
| 273 bool PlatformHandleInputEvent(const WebKit::WebInputEvent& event, | |
| 274 WebKit::WebCursorInfo* cursor_info); | |
| 275 | |
| 276 NPAPI::PluginInstance* instance() { return instance_.get(); } | |
| 277 | |
| 278 // Closes down and destroys our plugin instance. | |
| 279 void DestroyInstance(); | |
| 280 | |
| 281 | |
| 282 // used for windowed plugins | |
| 283 // Note: on Mac OS X, the only time the windowed handle is non-zero | |
| 284 // is the case of accelerated rendering, which uses a fake window handle to | |
| 285 // identify itself back to the browser. It still performs all of its | |
| 286 // work offscreen. | |
| 287 gfx::PluginWindowHandle windowed_handle_; | |
| 288 gfx::Rect windowed_last_pos_; | |
| 289 | |
| 290 bool windowed_did_set_window_; | |
| 291 | |
| 292 // used by windowed and windowless plugins | |
| 293 bool windowless_; | |
| 294 | |
| 295 webkit_glue::WebPlugin* plugin_; | |
| 296 scoped_refptr<NPAPI::PluginInstance> instance_; | |
| 297 | |
| 298 #if defined(OS_WIN) | |
| 299 // Original wndproc before we subclassed. | |
| 300 WNDPROC plugin_wnd_proc_; | |
| 301 | |
| 302 // Used to throttle WM_USER+1 messages in Flash. | |
| 303 uint32 last_message_; | |
| 304 bool is_calling_wndproc; | |
| 305 | |
| 306 // The current keyboard layout of this process and the main thread ID of the | |
| 307 // browser process. These variables are used for synchronizing the keyboard | |
| 308 // layout of this process with the one of the browser process. | |
| 309 HKL keyboard_layout_; | |
| 310 int parent_thread_id_; | |
| 311 #endif // defined(OS_WIN) | |
| 312 | |
| 313 #if defined(USE_X11) | |
| 314 // The SHM pixmap for a windowless plugin. | |
| 315 XID windowless_shm_pixmap_; | |
| 316 | |
| 317 // The pixmap we're drawing into, for a windowless plugin. | |
| 318 GdkPixmap* pixmap_; | |
| 319 double first_event_time_; | |
| 320 | |
| 321 // On Linux some plugins assume that the GtkSocket container is in the same | |
| 322 // process. So we create a GtkPlug to plug into the browser's container, and | |
| 323 // a GtkSocket to hold the plugin. We then send the GtkPlug to the browser | |
| 324 // process. | |
| 325 GtkWidget* plug_; | |
| 326 GtkWidget* socket_; | |
| 327 | |
| 328 // Ensure pixmap_ exists and is at least width by height pixels. | |
| 329 void EnsurePixmapAtLeastSize(int width, int height); | |
| 330 #endif | |
| 331 | |
| 332 gfx::PluginWindowHandle parent_; | |
| 333 NPWindow window_; | |
| 334 gfx::Rect window_rect_; | |
| 335 gfx::Rect clip_rect_; | |
| 336 int quirks_; | |
| 337 | |
| 338 #if defined(OS_WIN) | |
| 339 // Windowless plugins don't have keyboard focus causing issues with the | |
| 340 // plugin not receiving keyboard events if the plugin enters a modal | |
| 341 // loop like TrackPopupMenuEx or MessageBox, etc. | |
| 342 // This is a basic issue with windows activation and focus arising due to | |
| 343 // the fact that these windows are created by different threads. Activation | |
| 344 // and focus are thread specific states, and if the browser has focus, | |
| 345 // the plugin may not have focus. | |
| 346 // To fix a majority of these activation issues we create a dummy visible | |
| 347 // child window to which we set focus whenever the windowless plugin | |
| 348 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. | |
| 349 | |
| 350 HWND dummy_window_for_activation_; | |
| 351 bool CreateDummyWindowForActivation(); | |
| 352 | |
| 353 // Returns true if the event passed in needs to be tracked for a potential | |
| 354 // modal loop. | |
| 355 static bool ShouldTrackEventForModalLoops(NPEvent* event); | |
| 356 | |
| 357 // The message filter hook procedure, which tracks modal loops entered by | |
| 358 // a plugin in the course of a NPP_HandleEvent call. | |
| 359 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, | |
| 360 LPARAM lParam); | |
| 361 | |
| 362 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function | |
| 363 // TrackPopupMenu. | |
| 364 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, | |
| 365 int y, int reserved, HWND window, | |
| 366 const RECT* rect); | |
| 367 | |
| 368 // SetCursor interceptor for windowless plugins. | |
| 369 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); | |
| 370 | |
| 371 // RegEnumKeyExW interceptor. | |
| 372 static LONG WINAPI RegEnumKeyExWPatch( | |
| 373 HKEY key, DWORD index, LPWSTR name, LPDWORD name_size, LPDWORD reserved, | |
| 374 LPWSTR class_name, LPDWORD class_size, PFILETIME last_write_time); | |
| 375 | |
| 376 // The mouse hook proc which handles mouse capture in windowed plugins. | |
| 377 static LRESULT CALLBACK MouseHookProc(int code, WPARAM wParam, | |
| 378 LPARAM lParam); | |
| 379 | |
| 380 // Calls SetCapture/ReleaseCapture based on the message type. | |
| 381 static void HandleCaptureForMessage(HWND window, UINT message); | |
| 382 | |
| 383 #elif defined(OS_MACOSX) | |
| 384 // Sets window_rect_ to |rect| | |
| 385 void SetPluginRect(const gfx::Rect& rect); | |
| 386 // Sets content_area_origin to |origin| | |
| 387 void SetContentAreaOrigin(const gfx::Point& origin); | |
| 388 // Updates everything that depends on the plugin's absolute screen location. | |
| 389 void PluginScreenLocationChanged(); | |
| 390 // Updates anything that depends on plugin visibility. | |
| 391 void PluginVisibilityChanged(); | |
| 392 | |
| 393 // Enables/disables IME. | |
| 394 void SetImeEnabled(bool enabled); | |
| 395 | |
| 396 // Informs the browser about the updated accelerated drawing surface. | |
| 397 void UpdateAcceleratedSurface(); | |
| 398 | |
| 399 // Uses a CARenderer to draw the plug-in's layer in our OpenGL surface. | |
| 400 void DrawLayerInSurface(); | |
| 401 | |
| 402 #ifndef NP_NO_CARBON | |
| 403 // Moves our dummy window to match the current screen location of the plugin. | |
| 404 void UpdateDummyWindowBounds(const gfx::Point& plugin_origin); | |
| 405 | |
| 406 #ifndef NP_NO_QUICKDRAW | |
| 407 // Sets the mode used for QuickDraw plugin drawing. If enabled is true the | |
| 408 // plugin draws into a GWorld that's not connected to a window (the faster | |
| 409 // path), otherwise the plugin draws into our invisible dummy window (which is | |
| 410 // slower, since the call we use to scrape the window contents is much more | |
| 411 // expensive than copying between GWorlds). | |
| 412 void SetQuickDrawFastPathEnabled(bool enabled); | |
| 413 #endif | |
| 414 | |
| 415 // Adjusts the idle event rate for a Carbon plugin based on its current | |
| 416 // visibility. | |
| 417 void UpdateIdleEventRate(); | |
| 418 #endif // !NP_NO_CARBON | |
| 419 | |
| 420 CGContextRef buffer_context_; // Weak ref. | |
| 421 | |
| 422 #ifndef NP_NO_CARBON | |
| 423 NP_CGContext np_cg_context_; | |
| 424 #endif | |
| 425 #ifndef NP_NO_QUICKDRAW | |
| 426 NP_Port qd_port_; | |
| 427 scoped_ptr<QuickDrawDrawingManager> qd_manager_; | |
| 428 base::TimeTicks fast_path_enable_tick_; | |
| 429 #endif | |
| 430 | |
| 431 CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in. | |
| 432 webkit_glue::WebPluginAcceleratedSurface* surface_; // Weak ref. | |
| 433 CARenderer* renderer_; // Renders layer_ to surface_. | |
| 434 scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_; | |
| 435 | |
| 436 // The upper-left corner of the web content area in screen coordinates, | |
| 437 // relative to an upper-left (0,0). | |
| 438 gfx::Point content_area_origin_; | |
| 439 | |
| 440 bool containing_window_has_focus_; | |
| 441 bool initial_window_focus_; | |
| 442 bool container_is_visible_; | |
| 443 bool have_called_set_window_; | |
| 444 | |
| 445 gfx::Rect cached_clip_rect_; | |
| 446 | |
| 447 bool ime_enabled_; | |
| 448 | |
| 449 scoped_ptr<ExternalDragTracker> external_drag_tracker_; | |
| 450 #endif // OS_MACOSX | |
| 451 | |
| 452 // Called by the message filter hook when the plugin enters a modal loop. | |
| 453 void OnModalLoopEntered(); | |
| 454 | |
| 455 // Returns true if the message passed in corresponds to a user gesture. | |
| 456 static bool IsUserGesture(const WebKit::WebInputEvent& event); | |
| 457 | |
| 458 // The url with which the plugin was instantiated. | |
| 459 std::string plugin_url_; | |
| 460 | |
| 461 #if defined(OS_WIN) | |
| 462 // Indicates the end of a user gesture period. | |
| 463 void OnUserGestureEnd(); | |
| 464 | |
| 465 // Handle to the message filter hook | |
| 466 HHOOK handle_event_message_filter_hook_; | |
| 467 | |
| 468 // Event which is set when the plugin enters a modal loop in the course | |
| 469 // of a NPP_HandleEvent call. | |
| 470 HANDLE handle_event_pump_messages_event_; | |
| 471 | |
| 472 // This flag indicates whether we started tracking a user gesture message. | |
| 473 bool user_gesture_message_posted_; | |
| 474 | |
| 475 // Runnable Method Factory used to invoke the OnUserGestureEnd method | |
| 476 // asynchronously. | |
| 477 ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; | |
| 478 | |
| 479 // Handle to the mouse hook installed for certain windowed plugins like | |
| 480 // flash. | |
| 481 HHOOK mouse_hook_; | |
| 482 #endif | |
| 483 | |
| 484 // Holds the depth of the HandleEvent callstack. | |
| 485 int handle_event_depth_; | |
| 486 | |
| 487 // Holds the current cursor set by the windowless plugin. | |
| 488 WebCursor current_windowless_cursor_; | |
| 489 | |
| 490 // Set to true initially and indicates if this is the first npp_setwindow | |
| 491 // call received by the plugin. | |
| 492 bool first_set_window_call_; | |
| 493 | |
| 494 // True if the plugin thinks it has keyboard focus | |
| 495 bool plugin_has_focus_; | |
| 496 // True if the plugin element has focus within the web content, regardless of | |
| 497 // whether its containing view currently has focus. | |
| 498 bool has_webkit_focus_; | |
| 499 // True if the containing view currently has focus. | |
| 500 // Initially set to true so that plugin focus still works in environments | |
| 501 // where SetContentAreaHasFocus is never called. See | |
| 502 // https://bugs.webkit.org/show_bug.cgi?id=46013 for details. | |
| 503 bool containing_view_has_focus_; | |
| 504 | |
| 505 // True if NPP_New did not return an error. | |
| 506 bool creation_succeeded_; | |
| 507 | |
| 508 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); | |
| 509 }; | |
| 510 | |
| 511 #endif // WEBKIT_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_ | |
| OLD | NEW |