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