diff options
-rw-r--r-- | chrome/browser/renderer_preferences_util.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/prefs/prefs_tab_helper.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/pepper/pepper_flash_fullscreen_host.cc | 4 | ||||
-rw-r--r-- | content/common/view_messages.h | 1 | ||||
-rw-r--r-- | content/public/common/renderer_preferences.cc | 3 | ||||
-rw-r--r-- | content/public/common/renderer_preferences.h | 3 | ||||
-rw-r--r-- | content/public/renderer/pepper_plugin_instance.h | 7 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.cc | 12 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_instance_impl.h | 2 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 4 | ||||
-rw-r--r-- | content/renderer/render_view_impl.h | 3 |
11 files changed, 40 insertions, 10 deletions
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc index a0f57f9..5e61d45 100644 --- a/chrome/browser/renderer_preferences_util.cc +++ b/chrome/browser/renderer_preferences_util.cc @@ -145,6 +145,11 @@ void UpdateFromSystemSettings( prefs->subpixel_rendering = GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); #endif + +#if !defined(OS_MACOSX) + prefs->plugin_fullscreen_allowed = + pref_service->GetBoolean(prefs::kFullscreenAllowed); +#endif } -} // renderer_preferences_util +} // namespace renderer_preferences_util diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 4a0e3aac..db0b657 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -424,6 +424,10 @@ PrefsTabHelper::PrefsTabHelper(WebContents* contents) pref_change_registrar_.Add(prefs::kEnableDoNotTrack, renderer_callback); pref_change_registrar_.Add(prefs::kEnableReferrers, renderer_callback); +#if !defined(OS_MACOSX) + pref_change_registrar_.Add(prefs::kFullscreenAllowed, renderer_callback); +#endif + PrefChangeRegistrar::NamedChangeCallback webkit_callback = base::Bind( &PrefsTabHelper::OnWebPrefChanged, base::Unretained(this)); for (int i = 0; i < kPrefsToObserveLength; ++i) { diff --git a/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc index 37bea81..4ebcbd9 100644 --- a/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc +++ b/chrome/renderer/pepper/pepper_flash_fullscreen_host.cc @@ -41,10 +41,8 @@ int32_t PepperFlashFullscreenHost::OnSetFullscreen( bool fullscreen) { content::PepperPluginInstance* plugin_instance = renderer_ppapi_host_->GetPluginInstance(pp_instance()); - if (plugin_instance) { - plugin_instance->FlashSetFullscreen(fullscreen, true); + if (plugin_instance && plugin_instance->FlashSetFullscreen(fullscreen, true)) return PP_OK; - } return PP_ERROR_FAILED; } diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 56baba6..ed0cf62 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -270,6 +270,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences) IPC_STRUCT_TRAITS_MEMBER(touchscreen_fling_profile) IPC_STRUCT_TRAITS_MEMBER(tap_multiple_targets_strategy) IPC_STRUCT_TRAITS_MEMBER(disable_client_blocked_error_page) + IPC_STRUCT_TRAITS_MEMBER(plugin_fullscreen_allowed) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::CookieData) diff --git a/content/public/common/renderer_preferences.cc b/content/public/common/renderer_preferences.cc index 7f375e7..9d3d12f 100644 --- a/content/public/common/renderer_preferences.cc +++ b/content/public/common/renderer_preferences.cc @@ -46,7 +46,8 @@ RendererPreferences::RendererPreferences() touchpad_fling_profile(3), touchscreen_fling_profile(3), tap_multiple_targets_strategy(TAP_MULTIPLE_TARGETS_STRATEGY_POPUP), - disable_client_blocked_error_page(false) { + disable_client_blocked_error_page(false), + plugin_fullscreen_allowed(true) { touchpad_fling_profile[0] = kDefaultAlpha; touchpad_fling_profile[1] = kDefaultBeta; touchpad_fling_profile[2] = kDefaultGamma; diff --git a/content/public/common/renderer_preferences.h b/content/public/common/renderer_preferences.h index d08f828..acbc197 100644 --- a/content/public/common/renderer_preferences.h +++ b/content/public/common/renderer_preferences.h @@ -141,6 +141,9 @@ struct CONTENT_EXPORT RendererPreferences { // Disables rendering default error page when client choses to block a page. // Corresponds to net::ERR_BLOCKED_BY_CLIENT. bool disable_client_blocked_error_page; + + // Determines whether plugins are allowed to enter fullscreen mode. + bool plugin_fullscreen_allowed; }; } // namespace content diff --git a/content/public/renderer/pepper_plugin_instance.h b/content/public/renderer/pepper_plugin_instance.h index 834a55b..b52b943 100644 --- a/content/public/renderer/pepper_plugin_instance.h +++ b/content/public/renderer/pepper_plugin_instance.h @@ -79,8 +79,11 @@ class PepperPluginInstance { // 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. - virtual void FlashSetFullscreen(bool fullscreen, bool delay_report) = 0; + // be true to avoid re-entrancy. Returns true if the switch will be carried + // out, because of this call or because a switch was pending already anyway. + // Returns false if the switch will not be carried out because fullscreen mode + // is disallowed by a preference. + virtual bool FlashSetFullscreen(bool fullscreen, bool delay_report) = 0; virtual bool IsRectTopmost(const gfx::Rect& rect) = 0; diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 5071325..a993d25 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -1639,6 +1639,9 @@ bool PepperPluginInstanceImpl::SetFullscreen(bool fullscreen) { if (fullscreen == IsFullscreenOrPending()) return false; + if (fullscreen && !render_view_->IsPluginFullscreenAllowed()) + return false; + // Check whether we are trying to switch while the state is in transition. // The 2nd request gets dropped while messing up the internal state, so // disallow this. @@ -2746,7 +2749,7 @@ bool PepperPluginInstanceImpl::IsFullPagePlugin() { return frame->view()->mainFrame()->document().isPluginDocument(); } -void PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, +bool PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, bool delay_report) { TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::FlashSetFullscreen"); // Keep a reference on the stack. See NOTE above. @@ -2756,7 +2759,10 @@ void PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, // 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 == FlashIsFullscreenOrPending()) - return; + return true; + + if (fullscreen && !render_view_->IsPluginFullscreenAllowed()) + return false; // Unbind current 2D or 3D graphics context. VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); @@ -2777,6 +2783,8 @@ void PepperPluginInstanceImpl::FlashSetFullscreen(bool fullscreen, base::Bind(&PepperPluginInstanceImpl::ReportGeometry, this)); } } + + return true; } bool PepperPluginInstanceImpl::IsRectTopmost(const gfx::Rect& rect) { diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h index 3113820..42d7d71 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.h +++ b/content/renderer/pepper/pepper_plugin_instance_impl.h @@ -359,7 +359,7 @@ class CONTENT_EXPORT PepperPluginInstanceImpl int plugin_child_id) OVERRIDE; virtual void SetAlwaysOnTop(bool on_top) OVERRIDE; virtual bool IsFullPagePlugin() OVERRIDE; - virtual void FlashSetFullscreen(bool fullscreen, bool delay_report) OVERRIDE; + virtual bool FlashSetFullscreen(bool fullscreen, bool delay_report) OVERRIDE; virtual bool IsRectTopmost(const gfx::Rect& rect) OVERRIDE; virtual int32_t Navigate(const ppapi::URLRequestInfoData& request, const char* target, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index eb1fa13..6827468 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -6474,6 +6474,10 @@ void RenderViewImpl::SetMediaStreamClientForTesting( media_stream_client_ = media_stream_client; } +bool RenderViewImpl::IsPluginFullscreenAllowed() { + return renderer_preferences_.plugin_fullscreen_allowed; +} + void RenderViewImpl::OnReleaseDisambiguationPopupDIB( TransportDIB::Handle dib_handle) { TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index c96bd74..2b18b3c 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -396,6 +396,9 @@ class CONTENT_EXPORT RenderViewImpl // Must be called before any players are created. void SetMediaStreamClientForTesting(MediaStreamClient* media_stream_client); + // Determines whether plugins are allowed to enter fullscreen mode. + bool IsPluginFullscreenAllowed(); + // IPC::Listener implementation ---------------------------------------------- virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |