Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl.h

Issue 10905122: Initial NPAPI plugin support in Win Aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webkit_glue.gypi ('k') | webkit/plugins/npapi/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
13 #include "base/sequenced_task_runner_helpers.h" 14 #include "base/sequenced_task_runner_helpers.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "base/timer.h" 16 #include "base/timer.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "third_party/npapi/bindings/npapi.h" 18 #include "third_party/npapi/bindings/npapi.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
20 #include "webkit/glue/webcursor.h" 21 #include "webkit/glue/webcursor.h"
21 #include "webkit/plugins/npapi/webplugin_delegate.h" 22 #include "webkit/plugins/npapi/webplugin_delegate.h"
22 #include "webkit/plugins/webkit_plugins_export.h" 23 #include "webkit/plugins/webkit_plugins_export.h"
23 24
24 #if defined(OS_WIN) && !defined(USE_AURA)
25 #include "base/memory/weak_ptr.h"
26 #endif
27
28 #if defined(USE_X11) 25 #if defined(USE_X11)
29 #include "ui/base/x/x11_util.h" 26 #include "ui/base/x/x11_util.h"
30 27
31 typedef struct _GdkDrawable GdkPixmap; 28 typedef struct _GdkDrawable GdkPixmap;
32 #endif 29 #endif
33 30
34 class FilePath; 31 class FilePath;
35 32
36 #if defined(OS_MACOSX) 33 #if defined(OS_MACOSX)
37 #ifdef __OBJC__ 34 #ifdef __OBJC__
38 @class CALayer; 35 @class CALayer;
39 @class CARenderer; 36 @class CARenderer;
40 #else 37 #else
41 class CALayer; 38 class CALayer;
42 class CARenderer; 39 class CARenderer;
43 #endif 40 #endif
44 #endif 41 #endif
45 42
46 namespace webkit { 43 namespace webkit {
47 namespace npapi { 44 namespace npapi {
48 45
49 class PluginInstance; 46 class PluginInstance;
50 47
51 #if defined(OS_MACOSX) 48 #if defined(OS_MACOSX)
52 class WebPluginAcceleratedSurface; 49 class WebPluginAcceleratedSurface;
53 class ExternalDragTracker; 50 class ExternalDragTracker;
54 #endif // OS_MACOSX 51 #endif // OS_MACOSX
55 52
56 #if defined(OS_WIN) && !defined(USE_AURA) 53 #if defined(OS_WIN)
57 class WebPluginIMEWin; 54 class WebPluginIMEWin;
58 #endif // OS_WIN 55 #endif // OS_WIN
59 56
60 // An implementation of WebPluginDelegate that runs in the plugin process, 57 // An implementation of WebPluginDelegate that runs in the plugin process,
61 // proxied from the renderer by WebPluginDelegateProxy. 58 // proxied from the renderer by WebPluginDelegateProxy.
62 class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { 59 class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate {
63 public: 60 public:
64 enum PluginQuirks { 61 enum PluginQuirks {
65 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 62 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32
66 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 63 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32
(...skipping 14 matching lines...) Expand all
81 PLUGIN_QUIRK_REPARENT_IN_BROWSER = 131072, // Windows 78 PLUGIN_QUIRK_REPARENT_IN_BROWSER = 131072, // Windows
82 PLUGIN_QUIRK_PATCH_GETKEYSTATE = 262144, // Windows 79 PLUGIN_QUIRK_PATCH_GETKEYSTATE = 262144, // Windows
83 PLUGIN_QUIRK_EMULATE_IME = 524288, // Windows. 80 PLUGIN_QUIRK_EMULATE_IME = 524288, // Windows.
84 PLUGIN_QUIRK_PATCH_VM_API = 1048576, // Windows. 81 PLUGIN_QUIRK_PATCH_VM_API = 1048576, // Windows.
85 }; 82 };
86 83
87 static WebPluginDelegateImpl* Create(const FilePath& filename, 84 static WebPluginDelegateImpl* Create(const FilePath& filename,
88 const std::string& mime_type, 85 const std::string& mime_type,
89 gfx::PluginWindowHandle containing_view); 86 gfx::PluginWindowHandle containing_view);
90 87
91 static bool IsPluginDelegateWindow(gfx::NativeWindow window); 88 #if defined(OS_WIN)
92 static bool GetPluginNameFromWindow(gfx::NativeWindow window, 89 static bool IsPluginDelegateWindow(HWND window);
90 static bool GetPluginNameFromWindow(HWND window,
93 string16* plugin_name); 91 string16* plugin_name);
94 static bool GetPluginVersionFromWindow(gfx::NativeWindow window, 92 static bool GetPluginVersionFromWindow(HWND window,
95 string16* plugin_version); 93 string16* plugin_version);
96 94
97 // Returns true if the window handle passed in is that of the dummy 95 // Returns true if the window handle passed in is that of the dummy
98 // activation window for windowless plugins. 96 // activation window for windowless plugins.
99 static bool IsDummyActivationWindow(gfx::NativeWindow window); 97 static bool IsDummyActivationWindow(HWND window);
98 #endif
100 99
101 // WebPluginDelegate implementation 100 // WebPluginDelegate implementation
102 virtual bool Initialize(const GURL& url, 101 virtual bool Initialize(const GURL& url,
103 const std::vector<std::string>& arg_names, 102 const std::vector<std::string>& arg_names,
104 const std::vector<std::string>& arg_values, 103 const std::vector<std::string>& arg_values,
105 WebPlugin* plugin, 104 WebPlugin* plugin,
106 bool load_manually) OVERRIDE; 105 bool load_manually) OVERRIDE;
107 virtual void PluginDestroyed() OVERRIDE; 106 virtual void PluginDestroyed() OVERRIDE;
108 virtual void UpdateGeometry(const gfx::Rect& window_rect, 107 virtual void UpdateGeometry(const gfx::Rect& window_rect,
109 const gfx::Rect& clip_rect) OVERRIDE; 108 const gfx::Rect& clip_rect) OVERRIDE;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 140
142 // Returns the path for the library implementing this plugin. 141 // Returns the path for the library implementing this plugin.
143 FilePath GetPluginPath(); 142 FilePath GetPluginPath();
144 143
145 // Returns a combination of PluginQuirks. 144 // Returns a combination of PluginQuirks.
146 int GetQuirks() const { return quirks_; } 145 int GetQuirks() const { return quirks_; }
147 146
148 // Informs the plugin that the view it is in has gained or lost focus. 147 // Informs the plugin that the view it is in has gained or lost focus.
149 void SetContentAreaHasFocus(bool has_focus); 148 void SetContentAreaHasFocus(bool has_focus);
150 149
151 #if defined(OS_WIN) && !defined(USE_AURA) 150 #if defined(OS_WIN)
152 // Informs the plug-in that an IME has changed its status. 151 // Informs the plug-in that an IME has changed its status.
153 void ImeCompositionUpdated(const string16& text, 152 void ImeCompositionUpdated(const string16& text,
154 const std::vector<int>& clauses, 153 const std::vector<int>& clauses,
155 const std::vector<int>& target, 154 const std::vector<int>& target,
156 int cursor_position); 155 int cursor_position);
157 156
158 // Informs the plugin that IME composition has completed./ If |text| is empty, 157 // Informs the plugin that IME composition has completed./ If |text| is empty,
159 // IME was cancelled. 158 // IME was cancelled.
160 void ImeCompositionCompleted(const string16& text); 159 void ImeCompositionCompleted(const string16& text);
161 160
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 gfx::Rect windowed_last_pos_; 324 gfx::Rect windowed_last_pos_;
326 325
327 bool windowed_did_set_window_; 326 bool windowed_did_set_window_;
328 327
329 // used by windowed and windowless plugins 328 // used by windowed and windowless plugins
330 bool windowless_; 329 bool windowless_;
331 330
332 WebPlugin* plugin_; 331 WebPlugin* plugin_;
333 scoped_refptr<PluginInstance> instance_; 332 scoped_refptr<PluginInstance> instance_;
334 333
335 #if defined(OS_WIN) && !defined(USE_AURA) 334 #if defined(OS_WIN)
336 // Original wndproc before we subclassed. 335 // Original wndproc before we subclassed.
337 WNDPROC plugin_wnd_proc_; 336 WNDPROC plugin_wnd_proc_;
338 337
339 // Used to throttle WM_USER+1 messages in Flash. 338 // Used to throttle WM_USER+1 messages in Flash.
340 uint32 last_message_; 339 uint32 last_message_;
341 bool is_calling_wndproc; 340 bool is_calling_wndproc;
342 341
343 // An IME emulator used by a windowless plug-in to retrieve IME data through 342 // An IME emulator used by a windowless plug-in to retrieve IME data through
344 // IMM32 functions. 343 // IMM32 functions.
345 scoped_ptr<WebPluginIMEWin> plugin_ime_; 344 scoped_ptr<WebPluginIMEWin> plugin_ime_;
(...skipping 19 matching lines...) Expand all
365 // Ensure pixmap_ exists and is at least width by height pixels. 364 // Ensure pixmap_ exists and is at least width by height pixels.
366 void EnsurePixmapAtLeastSize(int width, int height); 365 void EnsurePixmapAtLeastSize(int width, int height);
367 #endif 366 #endif
368 367
369 gfx::PluginWindowHandle parent_; 368 gfx::PluginWindowHandle parent_;
370 NPWindow window_; 369 NPWindow window_;
371 gfx::Rect window_rect_; 370 gfx::Rect window_rect_;
372 gfx::Rect clip_rect_; 371 gfx::Rect clip_rect_;
373 int quirks_; 372 int quirks_;
374 373
375 #if defined(OS_WIN) && !defined(USE_AURA) 374 #if defined(OS_WIN)
376 // Windowless plugins don't have keyboard focus causing issues with the 375 // Windowless plugins don't have keyboard focus causing issues with the
377 // plugin not receiving keyboard events if the plugin enters a modal 376 // plugin not receiving keyboard events if the plugin enters a modal
378 // loop like TrackPopupMenuEx or MessageBox, etc. 377 // loop like TrackPopupMenuEx or MessageBox, etc.
379 // This is a basic issue with windows activation and focus arising due to 378 // This is a basic issue with windows activation and focus arising due to
380 // the fact that these windows are created by different threads. Activation 379 // the fact that these windows are created by different threads. Activation
381 // and focus are thread specific states, and if the browser has focus, 380 // and focus are thread specific states, and if the browser has focus,
382 // the plugin may not have focus. 381 // the plugin may not have focus.
383 // To fix a majority of these activation issues we create a dummy visible 382 // To fix a majority of these activation issues we create a dummy visible
384 // child window to which we set focus whenever the windowless plugin 383 // child window to which we set focus whenever the windowless plugin
385 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. 384 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 492
494 // Called by the message filter hook when the plugin enters a modal loop. 493 // Called by the message filter hook when the plugin enters a modal loop.
495 void OnModalLoopEntered(); 494 void OnModalLoopEntered();
496 495
497 // Returns true if the message passed in corresponds to a user gesture. 496 // Returns true if the message passed in corresponds to a user gesture.
498 static bool IsUserGesture(const WebKit::WebInputEvent& event); 497 static bool IsUserGesture(const WebKit::WebInputEvent& event);
499 498
500 // The url with which the plugin was instantiated. 499 // The url with which the plugin was instantiated.
501 std::string plugin_url_; 500 std::string plugin_url_;
502 501
503 #if defined(OS_WIN) && !defined(USE_AURA) 502 #if defined(OS_WIN)
504 // Indicates the end of a user gesture period. 503 // Indicates the end of a user gesture period.
505 void OnUserGestureEnd(); 504 void OnUserGestureEnd();
506 505
507 // Handle to the message filter hook 506 // Handle to the message filter hook
508 HHOOK handle_event_message_filter_hook_; 507 HHOOK handle_event_message_filter_hook_;
509 508
510 // Event which is set when the plugin enters a modal loop in the course 509 // Event which is set when the plugin enters a modal loop in the course
511 // of a NPP_HandleEvent call. 510 // of a NPP_HandleEvent call.
512 HANDLE handle_event_pump_messages_event_; 511 HANDLE handle_event_pump_messages_event_;
513 512
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 // True if NPP_New did not return an error. 546 // True if NPP_New did not return an error.
548 bool creation_succeeded_; 547 bool creation_succeeded_;
549 548
550 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); 549 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl);
551 }; 550 };
552 551
553 } // namespace npapi 552 } // namespace npapi
554 } // namespace webkit 553 } // namespace webkit
555 554
556 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 555 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/glue/webkit_glue.gypi ('k') | webkit/plugins/npapi/webplugin_delegate_impl_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698