| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 | 1997 |
| 1998 // Check whether we are trying to switch while the state is in transition. | 1998 // Check whether we are trying to switch while the state is in transition. |
| 1999 // The 2nd request gets dropped while messing up the internal state, so | 1999 // The 2nd request gets dropped while messing up the internal state, so |
| 2000 // disallow this. | 2000 // disallow this. |
| 2001 if (view_data_.is_fullscreen != desired_fullscreen_state_) | 2001 if (view_data_.is_fullscreen != desired_fullscreen_state_) |
| 2002 return false; | 2002 return false; |
| 2003 | 2003 |
| 2004 if (fullscreen && !IsProcessingUserGesture()) | 2004 if (fullscreen && !IsProcessingUserGesture()) |
| 2005 return false; | 2005 return false; |
| 2006 | 2006 |
| 2007 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); | 2007 DVLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); |
| 2008 desired_fullscreen_state_ = fullscreen; | 2008 desired_fullscreen_state_ = fullscreen; |
| 2009 | 2009 |
| 2010 if (fullscreen) { | 2010 if (fullscreen) { |
| 2011 // Create the user gesture in case we're processing one that's pending. | 2011 // Create the user gesture in case we're processing one that's pending. |
| 2012 WebScopedUserGesture user_gesture(CurrentUserGestureToken()); | 2012 WebScopedUserGesture user_gesture(CurrentUserGestureToken()); |
| 2013 // WebKit does not resize the plugin to fill the screen in fullscreen mode, | 2013 // WebKit does not resize the plugin to fill the screen in fullscreen mode, |
| 2014 // so we will tweak plugin's attributes to support the expected behavior. | 2014 // so we will tweak plugin's attributes to support the expected behavior. |
| 2015 KeepSizeAttributesBeforeFullscreen(); | 2015 KeepSizeAttributesBeforeFullscreen(); |
| 2016 SetSizeAttributesForFullscreen(); | 2016 SetSizeAttributesForFullscreen(); |
| 2017 container_->element().requestFullScreen(); | 2017 container_->element().requestFullScreen(); |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3190 return true; | 3190 return true; |
| 3191 | 3191 |
| 3192 if (!render_frame_) | 3192 if (!render_frame_) |
| 3193 return false; | 3193 return false; |
| 3194 if (fullscreen && !render_frame_->render_view() | 3194 if (fullscreen && !render_frame_->render_view() |
| 3195 ->renderer_preferences() | 3195 ->renderer_preferences() |
| 3196 .plugin_fullscreen_allowed) | 3196 .plugin_fullscreen_allowed) |
| 3197 return false; | 3197 return false; |
| 3198 | 3198 |
| 3199 // Unbind current 2D or 3D graphics context. | 3199 // Unbind current 2D or 3D graphics context. |
| 3200 VLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); | 3200 DVLOG(1) << "Setting fullscreen to " << (fullscreen ? "on" : "off"); |
| 3201 if (fullscreen) { | 3201 if (fullscreen) { |
| 3202 DCHECK(!fullscreen_container_); | 3202 DCHECK(!fullscreen_container_); |
| 3203 fullscreen_container_ = | 3203 fullscreen_container_ = |
| 3204 render_frame_->CreatePepperFullscreenContainer(this); | 3204 render_frame_->CreatePepperFullscreenContainer(this); |
| 3205 UpdateLayer(false); | 3205 UpdateLayer(false); |
| 3206 } else { | 3206 } else { |
| 3207 DCHECK(fullscreen_container_); | 3207 DCHECK(fullscreen_container_); |
| 3208 fullscreen_container_->Destroy(); | 3208 fullscreen_container_->Destroy(); |
| 3209 fullscreen_container_ = NULL; | 3209 fullscreen_container_ = NULL; |
| 3210 UpdateFlashFullscreenState(false); | 3210 UpdateFlashFullscreenState(false); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3434 return; | 3434 return; |
| 3435 | 3435 |
| 3436 is_peripheral_content_ = false; | 3436 is_peripheral_content_ = false; |
| 3437 power_saver_enabled_ = false; | 3437 power_saver_enabled_ = false; |
| 3438 SetPluginThrottled(false); | 3438 SetPluginThrottled(false); |
| 3439 | 3439 |
| 3440 RecordUnthrottleMethodMetric(UNTHROTTLE_METHOD_BY_WHITELIST); | 3440 RecordUnthrottleMethodMetric(UNTHROTTLE_METHOD_BY_WHITELIST); |
| 3441 } | 3441 } |
| 3442 | 3442 |
| 3443 } // namespace content | 3443 } // namespace content |
| OLD | NEW |