Index: Source/web/WebPluginContainerImpl.h |
diff --git a/Source/web/WebPluginContainerImpl.h b/Source/web/WebPluginContainerImpl.h |
index 5ecc64f243310669c3ffa7dfb7622e08ddda9ff7..d8e46d698e51d19926ea26d16c24ea3e364d9c96 100644 |
--- a/Source/web/WebPluginContainerImpl.h |
+++ b/Source/web/WebPluginContainerImpl.h |
@@ -53,6 +53,7 @@ class ResourceError; |
class ResourceResponse; |
class TouchEvent; |
class WheelEvent; |
+class Widget; |
} |
namespace WebKit { |
@@ -197,6 +198,24 @@ private: |
bool m_wantsWheelEvents; |
}; |
+inline WebPluginContainerImpl* toPluginContainerImpl(WebCore::Widget* widget) |
+{ |
+ ASSERT_WITH_SECURITY_IMPLICATION(!widget || widget->isPluginContainer()); |
+ // We need to ensure that the object is actually of type PluginContainer |
+ // as there are many subclasses of Widget. |
+ return static_cast<WebPluginContainerImpl*>(widget); |
+} |
+ |
+inline WebPluginContainerImpl* toPluginContainerImpl(WebPluginContainer* container) |
+{ |
+ // Unlike Widget, we need not worry about object type for container. |
+ // WebPluginContainerImpl is the only subclass of WebPluginContainer. |
+ return static_cast<WebPluginContainerImpl*>(container); |
+} |
+ |
+// This will catch anyone doing an unnecessary cast. |
+void toPluginContainerImpl(const WebPluginContainerImpl*); |
+ |
} // namespace WebKit |
#endif |