OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 fullscreen_container_->Invalidate(); | 418 fullscreen_container_->Invalidate(); |
419 else if (container_) | 419 else if (container_) |
420 container_->commitBackingTexture(); | 420 container_->commitBackingTexture(); |
421 } | 421 } |
422 | 422 |
423 void PluginInstance::InstanceCrashed() { | 423 void PluginInstance::InstanceCrashed() { |
424 // Force free all resources and vars. | 424 // Force free all resources and vars. |
425 HostGlobals::Get()->InstanceCrashed(pp_instance()); | 425 HostGlobals::Get()->InstanceCrashed(pp_instance()); |
426 | 426 |
427 // Free any associated graphics. | 427 // Free any associated graphics. |
428 SetFullscreen(false, false); | 428 SetFullscreen(false); |
429 FlashSetFullscreen(false, false); | 429 FlashSetFullscreen(false, false); |
430 bound_graphics_ = NULL; | 430 bound_graphics_ = NULL; |
431 InvalidateRect(gfx::Rect()); | 431 InvalidateRect(gfx::Rect()); |
432 | 432 |
433 delegate()->PluginCrashed(this); | 433 delegate()->PluginCrashed(this); |
434 } | 434 } |
435 | 435 |
436 bool PluginInstance::SetCursor(PP_CursorType_Dev type, | 436 bool PluginInstance::SetCursor(PP_CursorType_Dev type, |
437 PP_Resource custom_image, | 437 PP_Resource custom_image, |
438 const PP_Point* hot_spot) { | 438 const PP_Point* hot_spot) { |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 } | 1149 } |
1150 | 1150 |
1151 bool PluginInstance::FlashIsFullscreenOrPending() { | 1151 bool PluginInstance::FlashIsFullscreenOrPending() { |
1152 return fullscreen_container_ != NULL; | 1152 return fullscreen_container_ != NULL; |
1153 } | 1153 } |
1154 | 1154 |
1155 bool PluginInstance::IsFullscreenOrPending() { | 1155 bool PluginInstance::IsFullscreenOrPending() { |
1156 return desired_fullscreen_state_; | 1156 return desired_fullscreen_state_; |
1157 } | 1157 } |
1158 | 1158 |
1159 bool PluginInstance::SetFullscreen(bool fullscreen, bool delay_report) { | 1159 bool PluginInstance::SetFullscreen(bool fullscreen) { |
1160 // Keep a reference on the stack. See NOTE above. | 1160 // Keep a reference on the stack. See NOTE above. |
1161 scoped_refptr<PluginInstance> ref(this); | 1161 scoped_refptr<PluginInstance> ref(this); |
1162 | 1162 |
1163 // Check whether we are trying to switch to the state we're already going | 1163 // Check whether we are trying to switch to the state we're already going |
1164 // to (i.e. if we're already switching to fullscreen but the fullscreen | 1164 // to (i.e. if we're already switching to fullscreen but the fullscreen |
1165 // container isn't ready yet, don't do anything more). | 1165 // container isn't ready yet, don't do anything more). |
1166 if (fullscreen == IsFullscreenOrPending()) | 1166 if (fullscreen == IsFullscreenOrPending()) |
1167 return false; | 1167 return false; |
1168 | 1168 |
1169 // Check whether we are trying to switch while the state is in transition. | 1169 // Check whether we are trying to switch while the state is in transition. |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) { | 1806 PP_Bool PluginInstance::IsFullscreen(PP_Instance instance) { |
1807 return PP_FromBool(fullscreen_); | 1807 return PP_FromBool(fullscreen_); |
1808 } | 1808 } |
1809 | 1809 |
1810 PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { | 1810 PP_Bool PluginInstance::FlashIsFullscreen(PP_Instance instance) { |
1811 return PP_FromBool(flash_fullscreen_); | 1811 return PP_FromBool(flash_fullscreen_); |
1812 } | 1812 } |
1813 | 1813 |
1814 PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, | 1814 PP_Bool PluginInstance::SetFullscreen(PP_Instance instance, |
1815 PP_Bool fullscreen) { | 1815 PP_Bool fullscreen) { |
1816 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen), true)); | 1816 return PP_FromBool(SetFullscreen(PP_ToBool(fullscreen))); |
1817 } | 1817 } |
1818 | 1818 |
1819 PP_Bool PluginInstance::FlashSetFullscreen(PP_Instance instance, | 1819 PP_Bool PluginInstance::FlashSetFullscreen(PP_Instance instance, |
1820 PP_Bool fullscreen) { | 1820 PP_Bool fullscreen) { |
1821 FlashSetFullscreen(PP_ToBool(fullscreen), true); | 1821 FlashSetFullscreen(PP_ToBool(fullscreen), true); |
1822 return PP_TRUE; | 1822 return PP_TRUE; |
1823 } | 1823 } |
1824 | 1824 |
1825 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { | 1825 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { |
1826 gfx::Size screen_size = delegate()->GetScreenSize(); | 1826 gfx::Size screen_size = delegate()->GetScreenSize(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 screen_size_for_fullscreen_ = gfx::Size(); | 2037 screen_size_for_fullscreen_ = gfx::Size(); |
2038 WebElement element = container_->element(); | 2038 WebElement element = container_->element(); |
2039 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2039 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2040 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2040 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2041 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2041 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2042 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2042 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2043 } | 2043 } |
2044 | 2044 |
2045 } // namespace ppapi | 2045 } // namespace ppapi |
2046 } // namespace webkit | 2046 } // namespace webkit |
OLD | NEW |