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

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

Issue 155172: Start using WebCursorInfo from the WebKit API. WebCursorInfo is a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
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 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/iat_patch.h" 11 #include "base/iat_patch.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/stats_counters.h" 14 #include "base/stats_counters.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "webkit/api/public/WebInputEvent.h" 16 #include "webkit/api/public/WebInputEvent.h"
17 #include "webkit/default_plugin/plugin_impl.h" 17 #include "webkit/default_plugin/plugin_impl.h"
18 #include "webkit/glue/glue_util.h" 18 #include "webkit/glue/glue_util.h"
19 #include "webkit/glue/webplugin.h"
20 #include "webkit/glue/plugins/plugin_constants_win.h" 19 #include "webkit/glue/plugins/plugin_constants_win.h"
21 #include "webkit/glue/plugins/plugin_instance.h" 20 #include "webkit/glue/plugins/plugin_instance.h"
22 #include "webkit/glue/plugins/plugin_lib.h" 21 #include "webkit/glue/plugins/plugin_lib.h"
23 #include "webkit/glue/plugins/plugin_list.h" 22 #include "webkit/glue/plugins/plugin_list.h"
24 #include "webkit/glue/plugins/plugin_stream_url.h" 23 #include "webkit/glue/plugins/plugin_stream_url.h"
25 #include "webkit/glue/webkit_glue.h" 24 #include "webkit/glue/webkit_glue.h"
25 #include "webkit/glue/webplugin.h"
26 26
27 using WebKit::WebCursorInfo;
27 using WebKit::WebKeyboardEvent; 28 using WebKit::WebKeyboardEvent;
28 using WebKit::WebInputEvent; 29 using WebKit::WebInputEvent;
29 using WebKit::WebMouseEvent; 30 using WebKit::WebMouseEvent;
30 31
31 namespace { 32 namespace {
32 33
33 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty"; 34 const wchar_t kWebPluginDelegateProperty[] = L"WebPluginDelegateProperty";
34 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom"; 35 const wchar_t kPluginNameAtomProperty[] = L"PluginNameAtom";
35 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation"; 36 const wchar_t kDummyActivationWindowName[] = L"DummyWindowForActivation";
36 const wchar_t kPluginOrigProc[] = L"OriginalPtr"; 37 const wchar_t kPluginOrigProc[] = L"OriginalPtr";
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 return false; 1100 return false;
1100 } 1101 }
1101 return NPEventFromWebKeyboardEvent( 1102 return NPEventFromWebKeyboardEvent(
1102 *static_cast<const WebKeyboardEvent*>(&event), np_event); 1103 *static_cast<const WebKeyboardEvent*>(&event), np_event);
1103 default: 1104 default:
1104 return false; 1105 return false;
1105 } 1106 }
1106 } 1107 }
1107 1108
1108 bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event, 1109 bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event,
1109 WebCursor* cursor) { 1110 WebCursorInfo* cursor_info) {
1110 DCHECK(windowless_) << "events should only be received in windowless mode"; 1111 DCHECK(windowless_) << "events should only be received in windowless mode";
1111 DCHECK(cursor != NULL); 1112 DCHECK(cursor_info != NULL);
1112 1113
1113 NPEvent np_event; 1114 NPEvent np_event;
1114 if (!NPEventFromWebInputEvent(event, &np_event)) { 1115 if (!NPEventFromWebInputEvent(event, &np_event)) {
1115 return false; 1116 return false;
1116 } 1117 }
1117 1118
1118 if (ShouldTrackEventForModalLoops(&np_event)) { 1119 if (ShouldTrackEventForModalLoops(&np_event)) {
1119 // A windowless plugin can enter a modal loop in a NPP_HandleEvent call. 1120 // A windowless plugin can enter a modal loop in a NPP_HandleEvent call.
1120 // For e.g. Flash puts up a context menu when we right click on the 1121 // For e.g. Flash puts up a context menu when we right click on the
1121 // windowless plugin area. We detect this by setting up a message filter 1122 // windowless plugin area. We detect this by setting up a message filter
(...skipping 24 matching lines...) Expand all
1146 pop_user_gesture = true; 1147 pop_user_gesture = true;
1147 instance()->PushPopupsEnabledState(true); 1148 instance()->PushPopupsEnabledState(true);
1148 } 1149 }
1149 1150
1150 bool ret = instance()->NPP_HandleEvent(&np_event) != 0; 1151 bool ret = instance()->NPP_HandleEvent(&np_event) != 0;
1151 1152
1152 if (np_event.event == WM_MOUSEMOVE) { 1153 if (np_event.event == WM_MOUSEMOVE) {
1153 // Snag a reference to the current cursor ASAP in case the plugin modified 1154 // Snag a reference to the current cursor ASAP in case the plugin modified
1154 // it. There is a nasty race condition here with the multiprocess browser 1155 // it. There is a nasty race condition here with the multiprocess browser
1155 // as someone might be setting the cursor in the main process as well. 1156 // as someone might be setting the cursor in the main process as well.
1156 *cursor = current_windowless_cursor_; 1157 current_windowless_cursor_.GetCursorInfo(cursor_info);
1157 } 1158 }
1158 1159
1159 if (pop_user_gesture) { 1160 if (pop_user_gesture) {
1160 instance()->PopPopupsEnabledState(); 1161 instance()->PopPopupsEnabledState();
1161 } 1162 }
1162 1163
1163 handle_event_depth_--; 1164 handle_event_depth_--;
1164 1165
1165 g_current_plugin_instance = last_plugin_instance; 1166 g_current_plugin_instance = last_plugin_instance;
1166 1167
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 1314
1314 // It is ok to pass NULL here to GetCursor as we are not looking for cursor 1315 // It is ok to pass NULL here to GetCursor as we are not looking for cursor
1315 // types defined by Webkit. 1316 // types defined by Webkit.
1316 HCURSOR previous_cursor = 1317 HCURSOR previous_cursor =
1317 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); 1318 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL);
1318 1319
1319 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( 1320 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor(
1320 cursor); 1321 cursor);
1321 return previous_cursor; 1322 return previous_cursor;
1322 } 1323 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/webplugin_delegate_impl.h ('k') | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698