Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: Source/web/WebPluginContainerImpl.h

Issue 23570006: Refactoring: Add convenience method toPluginContainerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rework with comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebNode.cpp ('k') | Source/web/WebPluginDocument.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/web/WebNode.cpp ('k') | Source/web/WebPluginDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698