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

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

Issue 18712: Attempt to fix a IAT unpatch crash. (Closed)
Patch Set: Created 11 years, 11 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
OLDNEW
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
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/gfx/native_widget_types.h" 12 #include "base/gfx/native_widget_types.h"
13 #include "base/iat_patch.h"
14 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
15 #include "base/task.h" 14 #include "base/task.h"
16 #include "third_party/npapi/bindings/npapi.h" 15 #include "third_party/npapi/bindings/npapi.h"
17 #include "webkit/glue/webplugin_delegate.h" 16 #include "webkit/glue/webplugin_delegate.h"
18 #include "webkit/glue/webcursor.h" 17 #include "webkit/glue/webcursor.h"
19 18
20 namespace NPAPI { 19 namespace NPAPI {
21 class PluginInstance; 20 class PluginInstance;
22 }; 21 };
23 22
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // This is a basic issue with windows activation and focus arising due to 195 // This is a basic issue with windows activation and focus arising due to
197 // the fact that these windows are created by different threads. Activation 196 // the fact that these windows are created by different threads. Activation
198 // and focus are thread specific states, and if the browser has focus, 197 // and focus are thread specific states, and if the browser has focus,
199 // the plugin may not have focus. 198 // the plugin may not have focus.
200 // To fix a majority of these activation issues we create a dummy visible 199 // To fix a majority of these activation issues we create a dummy visible
201 // child window to which we set focus whenever the windowless plugin 200 // child window to which we set focus whenever the windowless plugin
202 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. 201 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent.
203 HWND dummy_window_for_activation_; 202 HWND dummy_window_for_activation_;
204 bool CreateDummyWindowForActivation(); 203 bool CreateDummyWindowForActivation();
205 204
206 static std::list<MSG> throttle_queue_;
207
208 // Returns true if the event passed in needs to be tracked for a potential 205 // Returns true if the event passed in needs to be tracked for a potential
209 // modal loop. 206 // modal loop.
210 static bool ShouldTrackEventForModalLoops(NPEvent* event); 207 static bool ShouldTrackEventForModalLoops(NPEvent* event);
211 208
212 // The message filter hook procedure, which tracks modal loops entered by 209 // The message filter hook procedure, which tracks modal loops entered by
213 // a plugin in the course of a NPP_HandleEvent call. 210 // a plugin in the course of a NPP_HandleEvent call.
214 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam, 211 static LRESULT CALLBACK HandleEventMessageFilterHook(int code, WPARAM wParam,
215 LPARAM lParam); 212 LPARAM lParam);
216 213
217 // Called by the message filter hook when the plugin enters a modal loop. 214 // Called by the message filter hook when the plugin enters a modal loop.
218 void OnModalLoopEntered(); 215 void OnModalLoopEntered();
219 216
220 // Returns true if the message passed in corresponds to a user gesture. 217 // Returns true if the message passed in corresponds to a user gesture.
221 static bool IsUserGestureMessage(unsigned int message); 218 static bool IsUserGestureMessage(unsigned int message);
222 219
223 // Indicates the end of a user gesture period. 220 // Indicates the end of a user gesture period.
224 void OnUserGestureEnd(); 221 void OnUserGestureEnd();
225 222
226 // Handle to the message filter hook 223 // Handle to the message filter hook
227 HHOOK handle_event_message_filter_hook_; 224 HHOOK handle_event_message_filter_hook_;
228 225
229 // The current instance of the plugin which entered the modal loop.
230 static WebPluginDelegateImpl* current_plugin_instance_;
231
232 // Event which is set when the plugin enters a modal loop in the course 226 // Event which is set when the plugin enters a modal loop in the course
233 // of a NPP_HandleEvent call. 227 // of a NPP_HandleEvent call.
234 HANDLE handle_event_pump_messages_event_; 228 HANDLE handle_event_pump_messages_event_;
235 229
236 // Holds the depth of the HandleEvent callstack. 230 // Holds the depth of the HandleEvent callstack.
237 int handle_event_depth_; 231 int handle_event_depth_;
238 232
239 // This flag indicates whether we started tracking a user gesture message. 233 // This flag indicates whether we started tracking a user gesture message.
240 bool user_gesture_message_posted_; 234 bool user_gesture_message_posted_;
241 235
242 // Runnable Method Factory used to invoke the OnUserGestureEnd method 236 // Runnable Method Factory used to invoke the OnUserGestureEnd method
243 // asynchronously. 237 // asynchronously.
244 ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_; 238 ScopedRunnableMethodFactory<WebPluginDelegateImpl> user_gesture_msg_factory_;
245 239
246 // The url with which the plugin was instantiated. 240 // The url with which the plugin was instantiated.
247 std::string plugin_url_; 241 std::string plugin_url_;
248 242
249 // The plugin module handle. 243 // The plugin module handle.
250 HMODULE plugin_module_handle_; 244 HMODULE plugin_module_handle_;
251 245
252 // Helper object for patching the TrackPopupMenu API
253 static iat_patch::IATPatchFunction iat_patch_track_popup_menu_;
254
255 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function 246 // TrackPopupMenu interceptor. Parameters are the same as the Win32 function
256 // TrackPopupMenu. 247 // TrackPopupMenu.
257 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x, 248 static BOOL WINAPI TrackPopupMenuPatch(HMENU menu, unsigned int flags, int x,
258 int y, int reserved, HWND window, 249 int y, int reserved, HWND window,
259 const RECT* rect); 250 const RECT* rect);
260 251
261 // SetCursor interceptor for windowless plugins. 252 // SetCursor interceptor for windowless plugins.
262 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor); 253 static HCURSOR WINAPI SetCursorPatch(HCURSOR cursor);
263 254
264 // Helper object for patching the SetCursor API
265 static iat_patch::IATPatchFunction iat_patch_set_cursor_;
266
267 // Holds the current cursor set by the windowless plugin. 255 // Holds the current cursor set by the windowless plugin.
268 WebCursor current_windowless_cursor_; 256 WebCursor current_windowless_cursor_;
269 257
270 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); 258 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl);
271 }; 259 };
272 260
273 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ 261 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
274 262
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/plugins/webplugin_delegate_impl.cc » ('j') | webkit/glue/plugins/webplugin_delegate_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698