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

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: 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..36b97fae2ff55d710fee11c71cbcff6ed7a36e44 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,25 @@ 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 many childs will be of type Widget.
tkent 2013/09/03 12:59:33 childs -> children, subclasses, or something?
+ return static_cast<WebPluginContainerImpl*>(widget);
+}
+
+inline WebPluginContainerImpl* toPluginContainerImpl(WebPluginContainer* container)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!container);
tkent 2013/09/03 12:59:33 This assertion is wrong. - Nullness doesn't have
+ // Unlike Widget, we need not worry about object type for container.
+ // WebPluginContainerImpl is the only child 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