OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
23 typedef struct _GdkDrawable GdkPixmap; | 23 typedef struct _GdkDrawable GdkPixmap; |
24 #endif | 24 #endif |
25 | 25 |
26 namespace NPAPI { | 26 namespace NPAPI { |
27 class PluginInstance; | 27 class PluginInstance; |
28 } | 28 } |
29 | 29 |
30 // An implementation of WebPluginDelegate that proxies all calls to | 30 // An implementation of WebPluginDelegate that proxies all calls to |
31 // the plugin process. | 31 // the plugin process. |
32 class WebPluginDelegateImpl : public WebPluginDelegate { | 32 class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { |
33 public: | 33 public: |
34 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | 34 static bool IsPluginDelegateWindow(gfx::NativeWindow window); |
35 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | 35 static bool GetPluginNameFromWindow(gfx::NativeWindow window, |
36 std::wstring *plugin_name); | 36 std::wstring *plugin_name); |
37 | 37 |
38 // Returns true if the window handle passed in is that of the dummy | 38 // Returns true if the window handle passed in is that of the dummy |
39 // activation window for windowless plugins. | 39 // activation window for windowless plugins. |
40 static bool IsDummyActivationWindow(gfx::NativeWindow window); | 40 static bool IsDummyActivationWindow(gfx::NativeWindow window); |
41 | 41 |
42 // WebPluginDelegate implementation | 42 // WebPluginDelegate implementation |
43 virtual void PluginDestroyed(); | 43 virtual void PluginDestroyed(); |
44 virtual bool Initialize(const GURL& url, | 44 virtual bool Initialize(const GURL& url, |
45 char** argn, | 45 char** argn, |
46 char** argv, | 46 char** argv, |
47 int argc, | 47 int argc, |
48 WebPlugin* plugin, | 48 webkit_glue::WebPlugin* plugin, |
49 bool load_manually); | 49 bool load_manually); |
50 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 50 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
51 const gfx::Rect& clip_rect); | 51 const gfx::Rect& clip_rect); |
52 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); | 52 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); |
53 virtual void Print(gfx::NativeDrawingContext context); | 53 virtual void Print(gfx::NativeDrawingContext context); |
54 | 54 |
55 virtual void SetFocus(); // only called when windowless | 55 virtual void SetFocus(); // only called when windowless |
56 // only called when windowless | 56 // only called when windowless |
57 // See NPAPI NPP_HandleEvent for more information. | 57 // See NPAPI NPP_HandleEvent for more information. |
58 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | 58 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, |
(...skipping 10 matching lines...) Expand all Loading... |
69 virtual void DidReceiveManualResponse(const GURL& url, | 69 virtual void DidReceiveManualResponse(const GURL& url, |
70 const std::string& mime_type, | 70 const std::string& mime_type, |
71 const std::string& headers, | 71 const std::string& headers, |
72 uint32 expected_length, | 72 uint32 expected_length, |
73 uint32 last_modified); | 73 uint32 last_modified); |
74 virtual void DidReceiveManualData(const char* buffer, int length); | 74 virtual void DidReceiveManualData(const char* buffer, int length); |
75 virtual void DidFinishManualLoading(); | 75 virtual void DidFinishManualLoading(); |
76 virtual void DidManualLoadFail(); | 76 virtual void DidManualLoadFail(); |
77 virtual FilePath GetPluginPath(); | 77 virtual FilePath GetPluginPath(); |
78 virtual void InstallMissingPlugin(); | 78 virtual void InstallMissingPlugin(); |
79 virtual WebPluginResourceClient* CreateResourceClient(int resource_id, | 79 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( |
80 const GURL& url, | 80 int resource_id, |
81 bool notify_needed, | 81 const GURL& url, |
82 intptr_t notify_data, | 82 bool notify_needed, |
83 intptr_t stream); | 83 intptr_t notify_data, |
| 84 intptr_t stream); |
84 | 85 |
85 virtual bool IsWindowless() const { return windowless_ ; } | 86 virtual bool IsWindowless() const { return windowless_ ; } |
86 virtual const gfx::Rect& GetRect() const { return window_rect_; } | 87 virtual gfx::Rect GetRect() const { return window_rect_; } |
87 virtual const gfx::Rect& GetClipRect() const { return clip_rect_; } | 88 virtual gfx::Rect GetClipRect() const { return clip_rect_; } |
88 virtual int GetQuirks() const { return quirks_; } | 89 virtual int GetQuirks() const { return quirks_; } |
89 | 90 |
90 #if defined(OS_MACOSX) | 91 #if defined(OS_MACOSX) |
91 // Informs the delegate that the context used for painting windowless plugins | 92 // Informs the delegate that the context used for painting windowless plugins |
92 // has changed. | 93 // has changed. |
93 virtual void UpdateContext(gfx::NativeDrawingContext context); | 94 virtual void UpdateContext(gfx::NativeDrawingContext context); |
94 #endif | 95 #endif |
95 | 96 |
96 private: | 97 private: |
97 friend class DeleteTask<WebPluginDelegateImpl>; | 98 friend class DeleteTask<WebPluginDelegateImpl>; |
98 | 99 |
99 WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view, | 100 WebPluginDelegateImpl(gfx::PluginWindowHandle containing_view, |
100 NPAPI::PluginInstance *instance); | 101 NPAPI::PluginInstance *instance); |
101 ~WebPluginDelegateImpl(); | 102 ~WebPluginDelegateImpl(); |
102 | 103 |
103 // Called by Initialize(), used for platform-specific initialization | 104 // Called by Initialize() for platform-specific initialization. |
104 // code. | 105 void PlatformInitialize(); |
105 void PlatformInitialize(WebPlugin* plugin); | |
106 | 106 |
107 // Called by DestroyInstance(), used for platform-specific destruction. | 107 // Called by DestroyInstance(), used for platform-specific destruction. |
108 void PlatformDestroyInstance(); | 108 void PlatformDestroyInstance(); |
109 | 109 |
110 #if !defined(OS_MACOSX) | 110 #if !defined(OS_MACOSX) |
111 //-------------------------- | 111 //-------------------------- |
112 // used for windowed plugins | 112 // used for windowed plugins |
113 void WindowedUpdateGeometry(const gfx::Rect& window_rect, | 113 void WindowedUpdateGeometry(const gfx::Rect& window_rect, |
114 const gfx::Rect& clip_rect); | 114 const gfx::Rect& clip_rect); |
115 // Create the native window. | 115 // Create the native window. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 // causes no regressions and eliminate from other platforms. | 178 // causes no regressions and eliminate from other platforms. |
179 // this is an optimization to avoid calling SetWindow to the plugin | 179 // this is an optimization to avoid calling SetWindow to the plugin |
180 // when it is not necessary. Initially, we need to call SetWindow, | 180 // when it is not necessary. Initially, we need to call SetWindow, |
181 // and after that we only need to call it when the geometry changes. | 181 // and after that we only need to call it when the geometry changes. |
182 // use this flag to indicate whether we really need it or not. | 182 // use this flag to indicate whether we really need it or not. |
183 bool windowless_needs_set_window_; | 183 bool windowless_needs_set_window_; |
184 | 184 |
185 // used by windowed and windowless plugins | 185 // used by windowed and windowless plugins |
186 bool windowless_; | 186 bool windowless_; |
187 | 187 |
188 WebPlugin* plugin_; | 188 webkit_glue::WebPlugin* plugin_; |
189 scoped_refptr<NPAPI::PluginInstance> instance_; | 189 scoped_refptr<NPAPI::PluginInstance> instance_; |
190 | 190 |
191 #if defined(OS_WIN) | 191 #if defined(OS_WIN) |
192 // Original wndproc before we subclassed. | 192 // Original wndproc before we subclassed. |
193 WNDPROC plugin_wnd_proc_; | 193 WNDPROC plugin_wnd_proc_; |
194 | 194 |
195 // Used to throttle WM_USER+1 messages in Flash. | 195 // Used to throttle WM_USER+1 messages in Flash. |
196 uint32 last_message_; | 196 uint32 last_message_; |
197 bool is_calling_wndproc; | 197 bool is_calling_wndproc; |
198 #endif // OS_WIN | 198 #endif // OS_WIN |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void OnNullEvent(); | 301 void OnNullEvent(); |
302 | 302 |
303 // last mouse position within the plugin's rect (used for null events) | 303 // last mouse position within the plugin's rect (used for null events) |
304 int last_mouse_x_; | 304 int last_mouse_x_; |
305 int last_mouse_y_; | 305 int last_mouse_y_; |
306 #endif | 306 #endif |
307 | 307 |
308 // Holds the current cursor set by the windowless plugin. | 308 // Holds the current cursor set by the windowless plugin. |
309 WebCursor current_windowless_cursor_; | 309 WebCursor current_windowless_cursor_; |
310 | 310 |
311 friend class WebPluginDelegate; | 311 friend class webkit_glue::WebPluginDelegate; |
312 | 312 |
313 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); | 313 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); |
314 }; | 314 }; |
315 | 315 |
316 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ | 316 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |