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 <string> | 8 #include <string> |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // WebPluginDelegate implementation | 35 // WebPluginDelegate implementation |
36 virtual void PluginDestroyed(); | 36 virtual void PluginDestroyed(); |
37 virtual bool Initialize(const GURL& url, | 37 virtual bool Initialize(const GURL& url, |
38 char** argn, | 38 char** argn, |
39 char** argv, | 39 char** argv, |
40 int argc, | 40 int argc, |
41 WebPlugin* plugin, | 41 WebPlugin* plugin, |
42 bool load_manually); | 42 bool load_manually); |
43 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 43 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
44 const gfx::Rect& clip_rect, bool visible); | 44 const gfx::Rect& clip_rect, |
| 45 const std::vector<gfx::Rect>& cutout_rects, |
| 46 bool visible); |
45 virtual void Paint(HDC hdc, const gfx::Rect& rect); | 47 virtual void Paint(HDC hdc, const gfx::Rect& rect); |
46 virtual void Print(HDC hdc); | 48 virtual void Print(HDC hdc); |
47 virtual void SetFocus(); // only called when windowless | 49 virtual void SetFocus(); // only called when windowless |
48 // only called when windowless | 50 // only called when windowless |
49 virtual bool HandleEvent(NPEvent* event, | 51 virtual bool HandleEvent(NPEvent* event, |
50 WebCursor* cursor); | 52 WebCursor* cursor); |
51 virtual NPObject* GetPluginScriptableObject(); | 53 virtual NPObject* GetPluginScriptableObject(); |
52 virtual void DidFinishLoadWithReason(NPReason reason); | 54 virtual void DidFinishLoadWithReason(NPReason reason); |
53 virtual int GetProcessId(); | 55 virtual int GetProcessId(); |
54 | 56 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, | 88 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, |
87 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, | 89 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, |
88 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, | 90 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, |
89 }; | 91 }; |
90 | 92 |
91 int quirks() { return quirks_; } | 93 int quirks() { return quirks_; } |
92 | 94 |
93 static void MoveWindow(HWND window, | 95 static void MoveWindow(HWND window, |
94 const gfx::Rect& window_rect, | 96 const gfx::Rect& window_rect, |
95 const gfx::Rect& clip_rect, | 97 const gfx::Rect& clip_rect, |
| 98 const std::vector<gfx::Rect>& cutout_rects, |
96 bool visible); | 99 bool visible); |
97 | 100 |
98 private: | 101 private: |
99 WebPluginDelegateImpl(HWND containing_window, | 102 WebPluginDelegateImpl(HWND containing_window, |
100 NPAPI::PluginInstance *instance); | 103 NPAPI::PluginInstance *instance); |
101 ~WebPluginDelegateImpl(); | 104 ~WebPluginDelegateImpl(); |
102 | 105 |
103 //-------------------------- | 106 //-------------------------- |
104 // used for windowed plugins | 107 // used for windowed plugins |
105 void WindowedUpdateGeometry(const gfx::Rect& window_rect, | 108 void WindowedUpdateGeometry(const gfx::Rect& window_rect, |
106 const gfx::Rect& clip_rect, bool visible); | 109 const gfx::Rect& clip_rect, |
| 110 const std::vector<gfx::Rect>& cutout_rects, |
| 111 bool visible); |
107 // Create the native window. | 112 // Create the native window. |
108 // Returns true if the window is created (or already exists). | 113 // Returns true if the window is created (or already exists). |
109 // Returns false if unable to create the window. | 114 // Returns false if unable to create the window. |
110 bool WindowedCreatePlugin(); | 115 bool WindowedCreatePlugin(); |
111 | 116 |
112 // Destroy the native window. | 117 // Destroy the native window. |
113 void WindowedDestroyWindow(); | 118 void WindowedDestroyWindow(); |
114 | 119 |
115 // Reposition the native window to be in sync with the given geometry. | 120 // Reposition the native window to be in sync with the given geometry. |
116 // Returns true if the native window has moved or been clipped differently. | 121 // Returns true if the native window has moved or been clipped differently. |
117 bool WindowedReposition(const gfx::Rect& window_rect, | 122 bool WindowedReposition(const gfx::Rect& window_rect, |
118 const gfx::Rect& clip_rect, bool visible); | 123 const gfx::Rect& clip_rect, |
| 124 const std::vector<gfx::Rect>& cutout_rects, |
| 125 bool visible); |
119 | 126 |
120 // Tells the plugin about the current state of the window. | 127 // Tells the plugin about the current state of the window. |
121 // See NPAPI NPP_SetWindow for more information. | 128 // See NPAPI NPP_SetWindow for more information. |
122 void WindowedSetWindow(); | 129 void WindowedSetWindow(); |
123 | 130 |
124 // Registers the window class for our window | 131 // Registers the window class for our window |
125 ATOM RegisterNativeWindowClass(); | 132 ATOM RegisterNativeWindowClass(); |
126 | 133 |
127 // Our WndProc functions. | 134 // Our WndProc functions. |
128 static LRESULT CALLBACK NativeWndProc( | 135 static LRESULT CALLBACK NativeWndProc( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 WNDPROC plugin_wnd_proc_; | 187 WNDPROC plugin_wnd_proc_; |
181 | 188 |
182 // Used to throttle WM_USER+1 messages in Flash. | 189 // Used to throttle WM_USER+1 messages in Flash. |
183 uint32 last_message_; | 190 uint32 last_message_; |
184 bool is_calling_wndproc; | 191 bool is_calling_wndproc; |
185 | 192 |
186 HWND parent_; | 193 HWND parent_; |
187 NPWindow window_; | 194 NPWindow window_; |
188 gfx::Rect window_rect_; | 195 gfx::Rect window_rect_; |
189 gfx::Rect clip_rect_; | 196 gfx::Rect clip_rect_; |
| 197 std::vector<gfx::Rect> cutout_rects_; |
190 int quirks_; | 198 int quirks_; |
191 | 199 |
192 // We only move/size the plugin window once after its creation. The | 200 // We only move/size the plugin window once after its creation. The |
193 // rest of the moves are controlled by the browser. This flag controls | 201 // rest of the moves are controlled by the browser. This flag controls |
194 // this behaviour. | 202 // this behaviour. |
195 bool initial_plugin_resize_done_; | 203 bool initial_plugin_resize_done_; |
196 | 204 |
197 // Windowless plugins don't have keyboard focus causing issues with the | 205 // Windowless plugins don't have keyboard focus causing issues with the |
198 // plugin not receiving keyboard events if the plugin enters a modal | 206 // plugin not receiving keyboard events if the plugin enters a modal |
199 // loop like TrackPopupMenuEx or MessageBox, etc. | 207 // loop like TrackPopupMenuEx or MessageBox, etc. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 bool load_manually_; | 262 bool load_manually_; |
255 | 263 |
256 // Indicates whether a geometry update sequence is the first. | 264 // Indicates whether a geometry update sequence is the first. |
257 bool first_geometry_update_; | 265 bool first_geometry_update_; |
258 | 266 |
259 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); | 267 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); |
260 }; | 268 }; |
261 | 269 |
262 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ | 270 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ |
263 | 271 |
OLD | NEW |