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

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

Issue 29004: We allow Flash to popup windows in response to user gesture messages like WM_... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 25 matching lines...) Expand all
36 // Flash can easily exceed the limits of our CPU if we don't throttle it. 36 // Flash can easily exceed the limits of our CPU if we don't throttle it.
37 // The throttle has been chosen by testing various delays and compromising 37 // The throttle has been chosen by testing various delays and compromising
38 // on acceptable Flash performance and reasonable CPU consumption. 38 // on acceptable Flash performance and reasonable CPU consumption.
39 // 39 //
40 // I'd like to make the throttle delay variable, based on the amount of 40 // I'd like to make the throttle delay variable, based on the amount of
41 // time currently required to paint Flash plugins. There isn't a good 41 // time currently required to paint Flash plugins. There isn't a good
42 // way to count the time spent in aggregate plugin painting, however, so 42 // way to count the time spent in aggregate plugin painting, however, so
43 // this seems to work well enough. 43 // this seems to work well enough.
44 const int kFlashWMUSERMessageThrottleDelayMs = 5; 44 const int kFlashWMUSERMessageThrottleDelayMs = 5;
45 45
46 // Flash displays popups in response to user clicks by posting a WM_USER
47 // message to the plugin window. The handler for this message displays
48 // the popup. To ensure that the popups allowed state is sent correctly
49 // to the renderer we reset the popups allowed state in a timer.
50 const int kWindowedPluginPopupTimerMs = 50;
51
46 // The current instance of the plugin which entered the modal loop. 52 // The current instance of the plugin which entered the modal loop.
47 WebPluginDelegateImpl* g_current_plugin_instance = NULL; 53 WebPluginDelegateImpl* g_current_plugin_instance = NULL;
48 54
49 base::LazyInstance<std::list<MSG> > g_throttle_queue(base::LINKER_INITIALIZED); 55 base::LazyInstance<std::list<MSG> > g_throttle_queue(base::LINKER_INITIALIZED);
50 56
51 // Helper object for patching the TrackPopupMenu API. 57 // Helper object for patching the TrackPopupMenu API.
52 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_track_popup_menu( 58 base::LazyInstance<iat_patch::IATPatchFunction> g_iat_patch_track_popup_menu(
53 base::LINKER_INITIALIZED); 59 base::LINKER_INITIALIZED);
54 60
55 // Helper object for patching the SetCursor API. 61 // Helper object for patching the SetCursor API.
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 883
878 delegate->last_message_ = message; 884 delegate->last_message_ = message;
879 delegate->is_calling_wndproc = true; 885 delegate->is_calling_wndproc = true;
880 886
881 if (!delegate->user_gesture_message_posted_ && 887 if (!delegate->user_gesture_message_posted_ &&
882 IsUserGestureMessage(message)) { 888 IsUserGestureMessage(message)) {
883 delegate->user_gesture_message_posted_ = true; 889 delegate->user_gesture_message_posted_ = true;
884 890
885 delegate->instance()->PushPopupsEnabledState(true); 891 delegate->instance()->PushPopupsEnabledState(true);
886 892
887 MessageLoop::current()->PostTask(FROM_HERE, 893 MessageLoop::current()->PostDelayedTask(FROM_HERE,
888 delegate->user_gesture_msg_factory_.NewRunnableMethod( 894 delegate->user_gesture_msg_factory_.NewRunnableMethod(
889 &WebPluginDelegateImpl::OnUserGestureEnd)); 895 &WebPluginDelegateImpl::OnUserGestureEnd),
896 kWindowedPluginPopupTimerMs);
890 } 897 }
891 898
892 LRESULT result = CallWindowProc(delegate->plugin_wnd_proc_, hwnd, message, 899 LRESULT result = CallWindowProc(delegate->plugin_wnd_proc_, hwnd, message,
893 wparam, lparam); 900 wparam, lparam);
894 delegate->is_calling_wndproc = false; 901 delegate->is_calling_wndproc = false;
895 g_current_plugin_instance = last_plugin_instance; 902 g_current_plugin_instance = last_plugin_instance;
896 return result; 903 return result;
897 } 904 }
898 905
899 void WebPluginDelegateImpl::WindowlessUpdateGeometry( 906 void WebPluginDelegateImpl::WindowlessUpdateGeometry(
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1195
1189 // It is ok to pass NULL here to GetCursor as we are not looking for cursor 1196 // It is ok to pass NULL here to GetCursor as we are not looking for cursor
1190 // types defined by Webkit. 1197 // types defined by Webkit.
1191 HCURSOR previous_cursor = 1198 HCURSOR previous_cursor =
1192 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL); 1199 g_current_plugin_instance->current_windowless_cursor_.GetCursor(NULL);
1193 1200
1194 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor( 1201 g_current_plugin_instance->current_windowless_cursor_.InitFromExternalCursor(
1195 cursor); 1202 cursor);
1196 return previous_cursor; 1203 return previous_cursor;
1197 } 1204 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698