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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2888203006: Move the logic to retrieve the WebPluginContainer to LocalFrame and Node. (Closed)
Patch Set: Ensure we have a valid PluginView before using it. Created 3 years, 7 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
Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index d6c6ba2f9253faa02f273f63f3e21860dbf5918d..fdf85f86a599cef1a382fed7f8be5ee1236b4e1f 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -55,6 +55,7 @@
#include "core/frame/VisualViewport.h"
#include "core/html/HTMLFrameElementBase.h"
#include "core/html/HTMLPlugInElement.h"
+#include "core/html/PluginDocument.h"
#include "core/input/EventHandler.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/layout/HitTestResult.h"
@@ -74,6 +75,7 @@
#include "core/paint/PaintLayer.h"
#include "core/paint/PaintLayerPainter.h"
#include "core/paint/TransformRecorder.h"
+#include "core/plugins/PluginView.h"
#include "core/probe/CoreProbes.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/timing/Performance.h"
@@ -974,4 +976,23 @@ std::unique_ptr<WebURLLoader> LocalFrame::CreateURLLoader() {
return Client()->CreateURLLoader();
}
+WebPluginContainerBase* LocalFrame::GetWebPluginContainerBase(
+ Node* node) const {
+ if (GetDocument() && GetDocument()->IsPluginDocument()) {
+ PluginDocument* plugin_document = ToPluginDocument(GetDocument());
+ if (plugin_document->GetPluginView()) {
+ return plugin_document->GetPluginView()->GetWebPluginContainerBase();
+ }
+ }
+ if (!node) {
+ DCHECK(GetDocument());
+ node = GetDocument()->FocusedElement();
+ }
+
+ if (node) {
+ return node->GetWebPluginContainerBase();
+ }
+ return nullptr;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/core/plugins/PluginView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698