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

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

Issue 5998002: Revert "Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_ 6 #define WEBKIT_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_
7
8 #include "build/build_config.h"
7 9
8 #include <string> 10 #include <string>
9 #include <list> 11 #include <list>
10 12
11 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
13 #include "base/task.h" 15 #include "base/task.h"
14 #include "base/time.h" 16 #include "base/time.h"
15 #include "base/timer.h" 17 #include "base/timer.h"
16 #include "build/build_config.h"
17 #include "gfx/native_widget_types.h" 18 #include "gfx/native_widget_types.h"
18 #include "gfx/rect.h" 19 #include "gfx/rect.h"
19 #include "third_party/npapi/bindings/npapi.h" 20 #include "third_party/npapi/bindings/npapi.h"
20 #include "webkit/plugins/npapi/webplugin_delegate.h" 21 #include "webkit/glue/plugins/webplugin_delegate.h"
21 #include "webkit/glue/webcursor.h" 22 #include "webkit/glue/webcursor.h"
22 23
23 #if defined(USE_X11) 24 #if defined(USE_X11)
24 #include "app/x11_util.h" 25 #include "app/x11_util.h"
25 26
26 typedef struct _GdkDrawable GdkPixmap; 27 typedef struct _GdkDrawable GdkPixmap;
27 #endif 28 #endif
28 29
29 class FilePath; 30 class FilePath;
30 31
32 namespace NPAPI {
33 class PluginInstance;
34 }
35
31 namespace WebKit { 36 namespace WebKit {
32 class WebMouseEvent; 37 class WebMouseEvent;
33 } 38 }
34 39
35 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
41 class ExternalDragTracker;
42 #ifndef NP_NO_QUICKDRAW
43 class QuickDrawDrawingManager;
44 #endif
36 #ifdef __OBJC__ 45 #ifdef __OBJC__
37 @class CALayer; 46 @class CALayer;
38 @class CARenderer; 47 @class CARenderer;
39 #else 48 #else
40 class CALayer; 49 class CALayer;
41 class CARenderer; 50 class CARenderer;
42 #endif 51 #endif
52 namespace webkit_glue {
53 class WebPluginAcceleratedSurface;
54 }
43 #endif 55 #endif
44 56
45 namespace webkit {
46 namespace npapi {
47
48 class PluginInstance;
49
50 #if defined(OS_MACOSX)
51 class WebPluginAcceleratedSurface;
52 class ExternalDragTracker;
53 #ifndef NP_NO_QUICKDRAW
54 class QuickDrawDrawingManager;
55 #endif // NP_NO_QUICKDRAW
56 #endif // OS_MACOSX
57
58 // An implementation of WebPluginDelegate that runs in the plugin process, 57 // An implementation of WebPluginDelegate that runs in the plugin process,
59 // proxied from the renderer by WebPluginDelegateProxy. 58 // proxied from the renderer by WebPluginDelegateProxy.
60 class WebPluginDelegateImpl : public WebPluginDelegate { 59 class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
61 public: 60 public:
62 enum PluginQuirks { 61 enum PluginQuirks {
63 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 62 PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32
64 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 63 PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32
65 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 64 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32
66 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 65 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32
67 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 66 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32
68 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 67 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32
69 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 68 PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32
70 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 69 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32
(...skipping 17 matching lines...) Expand all
88 std::wstring *plugin_name); 87 std::wstring *plugin_name);
89 88
90 // Returns true if the window handle passed in is that of the dummy 89 // Returns true if the window handle passed in is that of the dummy
91 // activation window for windowless plugins. 90 // activation window for windowless plugins.
92 static bool IsDummyActivationWindow(gfx::NativeWindow window); 91 static bool IsDummyActivationWindow(gfx::NativeWindow window);
93 92
94 // WebPluginDelegate implementation 93 // WebPluginDelegate implementation
95 virtual bool Initialize(const GURL& url, 94 virtual bool Initialize(const GURL& url,
96 const std::vector<std::string>& arg_names, 95 const std::vector<std::string>& arg_names,
97 const std::vector<std::string>& arg_values, 96 const std::vector<std::string>& arg_values,
98 WebPlugin* plugin, 97 webkit_glue::WebPlugin* plugin,
99 bool load_manually); 98 bool load_manually);
100 virtual void PluginDestroyed(); 99 virtual void PluginDestroyed();
101 virtual void UpdateGeometry(const gfx::Rect& window_rect, 100 virtual void UpdateGeometry(const gfx::Rect& window_rect,
102 const gfx::Rect& clip_rect); 101 const gfx::Rect& clip_rect);
103 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); 102 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect);
104 virtual void Print(gfx::NativeDrawingContext context); 103 virtual void Print(gfx::NativeDrawingContext context);
105 virtual void SetFocus(bool focused); 104 virtual void SetFocus(bool focused);
106 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, 105 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event,
107 WebKit::WebCursorInfo* cursor_info); 106 WebKit::WebCursorInfo* cursor_info);
108 virtual NPObject* GetPluginScriptableObject(); 107 virtual NPObject* GetPluginScriptableObject();
109 virtual void DidFinishLoadWithReason( 108 virtual void DidFinishLoadWithReason(
110 const GURL& url, NPReason reason, int notify_id); 109 const GURL& url, NPReason reason, int notify_id);
111 virtual int GetProcessId(); 110 virtual int GetProcessId();
112 virtual void SendJavaScriptStream(const GURL& url, 111 virtual void SendJavaScriptStream(const GURL& url,
113 const std::string& result, 112 const std::string& result,
114 bool success, 113 bool success,
115 int notify_id); 114 int notify_id);
116 virtual void DidReceiveManualResponse(const GURL& url, 115 virtual void DidReceiveManualResponse(const GURL& url,
117 const std::string& mime_type, 116 const std::string& mime_type,
118 const std::string& headers, 117 const std::string& headers,
119 uint32 expected_length, 118 uint32 expected_length,
120 uint32 last_modified); 119 uint32 last_modified);
121 virtual void DidReceiveManualData(const char* buffer, int length); 120 virtual void DidReceiveManualData(const char* buffer, int length);
122 virtual void DidFinishManualLoading(); 121 virtual void DidFinishManualLoading();
123 virtual void DidManualLoadFail(); 122 virtual void DidManualLoadFail();
124 virtual void InstallMissingPlugin(); 123 virtual void InstallMissingPlugin();
125 virtual WebPluginResourceClient* CreateResourceClient( 124 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient(
126 unsigned long resource_id, const GURL& url, int notify_id); 125 unsigned long resource_id, const GURL& url, int notify_id);
127 virtual WebPluginResourceClient* CreateSeekableResourceClient( 126 virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient(
128 unsigned long resource_id, int range_request_id); 127 unsigned long resource_id, int range_request_id);
129 // End of WebPluginDelegate implementation. 128 // End of WebPluginDelegate implementation.
130 129
131 bool IsWindowless() const { return windowless_ ; } 130 bool IsWindowless() const { return windowless_ ; }
132 gfx::Rect GetRect() const { return window_rect_; } 131 gfx::Rect GetRect() const { return window_rect_; }
133 gfx::Rect GetClipRect() const { return clip_rect_; } 132 gfx::Rect GetClipRect() const { return clip_rect_; }
134 133
135 // Returns the path for the library implementing this plugin. 134 // Returns the path for the library implementing this plugin.
136 FilePath GetPluginPath(); 135 FilePath GetPluginPath();
137 136
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #endif 187 #endif
189 188
190 #if defined(USE_X11) 189 #if defined(USE_X11)
191 void SetWindowlessShmPixmap(XID shm_pixmap) { 190 void SetWindowlessShmPixmap(XID shm_pixmap) {
192 windowless_shm_pixmap_ = shm_pixmap; 191 windowless_shm_pixmap_ = shm_pixmap;
193 } 192 }
194 #endif 193 #endif
195 194
196 private: 195 private:
197 friend class DeleteTask<WebPluginDelegateImpl>; 196 friend class DeleteTask<WebPluginDelegateImpl>;
198 friend class WebPluginDelegate; 197 friend class webkit_glue::WebPluginDelegate;
199 198
200 WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view, 199 WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view,
201 PluginInstance *instance); 200 NPAPI::PluginInstance *instance);
202 ~WebPluginDelegateImpl(); 201 ~WebPluginDelegateImpl();
203 202
204 // Called by Initialize() for platform-specific initialization. 203 // Called by Initialize() for platform-specific initialization.
205 // If this returns false, the plugin shouldn't be started--see Initialize(). 204 // If this returns false, the plugin shouldn't be started--see Initialize().
206 bool PlatformInitialize(); 205 bool PlatformInitialize();
207 206
208 // Called by DestroyInstance(), used for platform-specific destruction. 207 // Called by DestroyInstance(), used for platform-specific destruction.
209 void PlatformDestroyInstance(); 208 void PlatformDestroyInstance();
210 209
211 //-------------------------- 210 //--------------------------
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 bool PlatformSetPluginHasFocus(bool focused); 266 bool PlatformSetPluginHasFocus(bool focused);
268 267
269 //----------------------------------------- 268 //-----------------------------------------
270 // used for windowed and windowless plugins 269 // used for windowed and windowless plugins
271 270
272 // Does platform-specific event handling. Arguments and return are identical 271 // Does platform-specific event handling. Arguments and return are identical
273 // to HandleInputEvent. 272 // to HandleInputEvent.
274 bool PlatformHandleInputEvent(const WebKit::WebInputEvent& event, 273 bool PlatformHandleInputEvent(const WebKit::WebInputEvent& event,
275 WebKit::WebCursorInfo* cursor_info); 274 WebKit::WebCursorInfo* cursor_info);
276 275
277 PluginInstance* instance() { return instance_.get(); } 276 NPAPI::PluginInstance* instance() { return instance_.get(); }
278 277
279 // Closes down and destroys our plugin instance. 278 // Closes down and destroys our plugin instance.
280 void DestroyInstance(); 279 void DestroyInstance();
281 280
282 281
283 // used for windowed plugins 282 // used for windowed plugins
284 // Note: on Mac OS X, the only time the windowed handle is non-zero 283 // Note: on Mac OS X, the only time the windowed handle is non-zero
285 // is the case of accelerated rendering, which uses a fake window handle to 284 // is the case of accelerated rendering, which uses a fake window handle to
286 // identify itself back to the browser. It still performs all of its 285 // identify itself back to the browser. It still performs all of its
287 // work offscreen. 286 // work offscreen.
288 gfx::PluginWindowHandle windowed_handle_; 287 gfx::PluginWindowHandle windowed_handle_;
289 gfx::Rect windowed_last_pos_; 288 gfx::Rect windowed_last_pos_;
290 289
291 bool windowed_did_set_window_; 290 bool windowed_did_set_window_;
292 291
293 // used by windowed and windowless plugins 292 // used by windowed and windowless plugins
294 bool windowless_; 293 bool windowless_;
295 294
296 WebPlugin* plugin_; 295 webkit_glue::WebPlugin* plugin_;
297 scoped_refptr<PluginInstance> instance_; 296 scoped_refptr<NPAPI::PluginInstance> instance_;
298 297
299 #if defined(OS_WIN) 298 #if defined(OS_WIN)
300 // Original wndproc before we subclassed. 299 // Original wndproc before we subclassed.
301 WNDPROC plugin_wnd_proc_; 300 WNDPROC plugin_wnd_proc_;
302 301
303 // Used to throttle WM_USER+1 messages in Flash. 302 // Used to throttle WM_USER+1 messages in Flash.
304 uint32 last_message_; 303 uint32 last_message_;
305 bool is_calling_wndproc; 304 bool is_calling_wndproc;
306 305
307 // The current keyboard layout of this process and the main thread ID of the 306 // The current keyboard layout of this process and the main thread ID of the
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 #ifndef NP_NO_CARBON 422 #ifndef NP_NO_CARBON
424 NP_CGContext np_cg_context_; 423 NP_CGContext np_cg_context_;
425 #endif 424 #endif
426 #ifndef NP_NO_QUICKDRAW 425 #ifndef NP_NO_QUICKDRAW
427 NP_Port qd_port_; 426 NP_Port qd_port_;
428 scoped_ptr<QuickDrawDrawingManager> qd_manager_; 427 scoped_ptr<QuickDrawDrawingManager> qd_manager_;
429 base::TimeTicks fast_path_enable_tick_; 428 base::TimeTicks fast_path_enable_tick_;
430 #endif 429 #endif
431 430
432 CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in. 431 CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in.
433 WebPluginAcceleratedSurface* surface_; // Weak ref. 432 webkit_glue::WebPluginAcceleratedSurface* surface_; // Weak ref.
434 CARenderer* renderer_; // Renders layer_ to surface_. 433 CARenderer* renderer_; // Renders layer_ to surface_.
435 scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_; 434 scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_;
436 435
437 // The upper-left corner of the web content area in screen coordinates, 436 // The upper-left corner of the web content area in screen coordinates,
438 // relative to an upper-left (0,0). 437 // relative to an upper-left (0,0).
439 gfx::Point content_area_origin_; 438 gfx::Point content_area_origin_;
440 439
441 bool containing_window_has_focus_; 440 bool containing_window_has_focus_;
442 bool initial_window_focus_; 441 bool initial_window_focus_;
443 bool container_is_visible_; 442 bool container_is_visible_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // where SetContentAreaHasFocus is never called. See 501 // where SetContentAreaHasFocus is never called. See
503 // https://bugs.webkit.org/show_bug.cgi?id=46013 for details. 502 // https://bugs.webkit.org/show_bug.cgi?id=46013 for details.
504 bool containing_view_has_focus_; 503 bool containing_view_has_focus_;
505 504
506 // True if NPP_New did not return an error. 505 // True if NPP_New did not return an error.
507 bool creation_succeeded_; 506 bool creation_succeeded_;
508 507
509 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); 508 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl);
510 }; 509 };
511 510
512 } // namespace npapi 511 #endif // WEBKIT_GLUE_PLUGINS_WEBPLUGIN_DELEGATE_IMPL_H_
513 } // namespace webkit
514
515 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_DELEGATE_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate.cc ('k') | webkit/glue/plugins/webplugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698