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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 7764002: Require a user gesture to display the PPAPI file chooser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_file_chooser_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
===================================================================
--- webkit/plugins/ppapi/ppapi_plugin_instance.cc (revision 126073)
+++ webkit/plugins/ppapi/ppapi_plugin_instance.cc (working copy)
@@ -1245,7 +1245,7 @@
if (view_data_.is_fullscreen != desired_fullscreen_state_)
return false;
- if (fullscreen && !HasUserGesture())
+ if (fullscreen && !IsProcessingUserGesture())
return false;
VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off");
@@ -1668,6 +1668,15 @@
return frame->view()->mainFrame()->document().isPluginDocument();
}
+bool PluginInstance::IsProcessingUserGesture() {
+ PP_TimeTicks now =
+ ::ppapi::TimeTicksToPPTimeTicks(base::TimeTicks::Now());
+ // Give a lot of slack so tests won't be flaky. Well behaved plugins will
+ // close the user gesture.
+ const PP_TimeTicks kUserGestureDurationInSeconds = 10.0;
+ return (now - pending_user_gesture_ < kUserGestureDurationInSeconds);
+}
+
void PluginInstance::OnLockMouseACK(bool succeeded) {
if (!lock_mouse_callback_.func) {
NOTREACHED();
@@ -1716,15 +1725,6 @@
pending_user_gesture_ = 0.0;
}
-bool PluginInstance::HasUserGesture() {
- PP_TimeTicks now =
- ::ppapi::TimeTicksToPPTimeTicks(base::TimeTicks::Now());
- // Give a lot of slack so tests won't be flaky. Well behaved plugins will
- // close the user gesture.
- const PP_TimeTicks kUserGestureDurationInSeconds = 10.0;
- return (now - pending_user_gesture_ < kUserGestureDurationInSeconds);
-}
-
PPB_Instance_FunctionAPI* PluginInstance::AsPPB_Instance_FunctionAPI() {
return this;
}
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_file_chooser_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698