diff options
author | polina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 02:56:28 +0000 |
---|---|---|
committer | polina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-29 02:56:28 +0000 |
commit | 53f1a000c4cd5fcb2a74609a518ec074dcc46e3b (patch) | |
tree | 62c69105cd30fb6e0412ee6635739dad05c34890 /webkit/plugins | |
parent | cd681c453a82ab32086917f92884a5072cda46ae (diff) | |
download | chromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.zip chromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.tar.gz chromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.tar.bz2 |
PPAPI SetFullscreen: Do return PP_FALSE when transition cannot be process. The cases include:
- going into fullscreen when not processing a user gesture
- requesting a duplicate transition
Update tests.
BUG=41780
TEST=Pepper and NaCl tests, manually
Review URL: http://codereview.chromium.org/8070018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 17 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 6 |
2 files changed, 17 insertions, 6 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index cee7108..435cafb 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -931,7 +931,7 @@ bool PluginInstance::IsFullscreenOrPending() { return desired_fullscreen_state_; } -void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { +bool PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { // Keep a reference on the stack. See NOTE above. scoped_refptr<PluginInstance> ref(this); @@ -939,7 +939,16 @@ void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { // to (i.e. if we're already switching to fullscreen but the fullscreen // container isn't ready yet, don't do anything more). if (fullscreen == IsFullscreenOrPending()) - return; + return false; + + // The browser will allow us to go into fullscreen mode only when processing + // a user gesture. This is guaranteed to work with in-process plugins and + // out-of-process syncronous proxies, but might be an issue with Flash when + // it switches over from PPB_FlashFullscreen. + // TODO(polina, bbudge): make this work with asynchronous proxies. + WebFrame* frame = container_->element().document().frame(); + if (fullscreen && !frame->isProcessingUserGesture()) + return false; // Unbind current 2D or 3D graphics context. BindGraphics(pp_instance(), 0); @@ -956,6 +965,7 @@ void PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { MessageLoop::current()->PostTask( FROM_HERE, NewRunnableMethod(this, &PluginInstance::ReportGeometry)); } + return true; } void PluginInstance::FlashSetFullscreen(bool fullscreen, bool delay_report) { @@ -1560,8 +1570,7 @@ PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, PP_Bool fullscreen) { - SetFullscreen(PP_ToBool(fullscreen), true); - return PP_TRUE; + return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen), true)); } PP_Bool PluginInstance::FlashSetFullscreen(PP_Instance instance, diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index fdb3dce..6109278 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -256,8 +256,10 @@ class PluginInstance : public base::RefCounted<PluginInstance>, // Switches between fullscreen and normal mode. If |delay_report| is set to // false, it may report the new state through DidChangeView immediately. If // true, it will delay it. When called from the plugin, delay_report should be - // true to avoid re-entrancy. - void SetFullscreen(bool fullscreen, bool delay_report); + // true to avoid re-entrancy. Returns true on success, false on failure + // (e.g. trying to enter fullscreen when not processing a user gesture or + // trying to set fullscreen when already in fullscreen mode). + bool SetFullscreen(bool fullscreen, bool delay_report); // Implementation of PPB_Flash. int32_t Navigate(PPB_URLRequestInfo_Impl* request, |