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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 if (bound_graphics_.get() == NULL) | 1568 if (bound_graphics_.get() == NULL) |
1569 return NULL; | 1569 return NULL; |
1570 | 1570 |
1571 if (bound_graphics_->AsPPB_Surface3D_API()) | 1571 if (bound_graphics_->AsPPB_Surface3D_API()) |
1572 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); | 1572 return static_cast<PPB_Surface3D_Impl*>(bound_graphics_.get()); |
1573 return NULL; | 1573 return NULL; |
1574 } | 1574 } |
1575 | 1575 |
1576 void PluginInstance::setBackingTextureId(unsigned int id) { | 1576 void PluginInstance::setBackingTextureId(unsigned int id) { |
1577 // If we have a fullscreen_container_ (under PPB_FlashFullscreen) | 1577 // If we have a fullscreen_container_ (under PPB_FlashFullscreen) |
1578 // or desired_fullscreen_state is true (under PPB_Fullscreen_Dev), | 1578 // or desired_fullscreen_state is true (under PPB_Fullscreen), |
1579 // then the plugin is fullscreen or transitioning to fullscreen | 1579 // then the plugin is fullscreen or transitioning to fullscreen |
1580 // and the parent context is not the one for the browser page, | 1580 // and the parent context is not the one for the browser page, |
1581 // but for the fullscreen window, and so the parent texture ID | 1581 // but for the fullscreen window, and so the parent texture ID |
1582 // doesn't correspond to anything in the page's context. | 1582 // doesn't correspond to anything in the page's context. |
1583 // | 1583 // |
1584 // TODO(alokp): It would be better at some point to have the equivalent | 1584 // TODO(alokp): It would be better at some point to have the equivalent |
1585 // in the FullscreenContainer so that we don't need to poll | 1585 // in the FullscreenContainer so that we don't need to poll |
1586 if (fullscreen_container_ || desired_fullscreen_state_) | 1586 if (fullscreen_container_ || desired_fullscreen_state_) |
1587 return; | 1587 return; |
1588 | 1588 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 } | 1639 } |
1640 | 1640 |
1641 // Special-case clearing the current device. | 1641 // Special-case clearing the current device. |
1642 if (!device) { | 1642 if (!device) { |
1643 setBackingTextureId(0); | 1643 setBackingTextureId(0); |
1644 InvalidateRect(gfx::Rect()); | 1644 InvalidateRect(gfx::Rect()); |
1645 return PP_TRUE; | 1645 return PP_TRUE; |
1646 } | 1646 } |
1647 | 1647 |
1648 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or | 1648 // Refuse to bind if in transition to fullscreen with PPB_FlashFullscreen or |
1649 // to/from fullscreen with PPB_Fullscreen_Dev. | 1649 // to/from fullscreen with PPB_Fullscreen. |
1650 if ((fullscreen_container_ && !flash_fullscreen_) || | 1650 if ((fullscreen_container_ && !flash_fullscreen_) || |
1651 desired_fullscreen_state_ != fullscreen_) | 1651 desired_fullscreen_state_ != fullscreen_) |
1652 return PP_FALSE; | 1652 return PP_FALSE; |
1653 | 1653 |
1654 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); | 1654 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); |
1655 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? | 1655 PPB_Graphics2D_Impl* graphics_2d = enter_2d.succeeded() ? |
1656 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; | 1656 static_cast<PPB_Graphics2D_Impl*>(enter_2d.object()) : NULL; |
1657 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); | 1657 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
1658 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? | 1658 PPB_Graphics3D_Impl* graphics_3d = enter_3d.succeeded() ? |
1659 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; | 1659 static_cast<PPB_Graphics3D_Impl*>(enter_3d.object()) : NULL; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 screen_size_for_fullscreen_ = gfx::Size(); | 2063 screen_size_for_fullscreen_ = gfx::Size(); |
2064 WebElement element = container_->element(); | 2064 WebElement element = container_->element(); |
2065 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2065 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
2066 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2066 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
2067 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2067 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
2068 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2068 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
2069 } | 2069 } |
2070 | 2070 |
2071 } // namespace ppapi | 2071 } // namespace ppapi |
2072 } // namespace webkit | 2072 } // namespace webkit |
OLD | NEW |