Index: components/plugins/renderer/webview_plugin.cc |
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc |
index 80404cfe8a37bf45a2894bf8631a452680cf3fef..b5da7d5f7011650d25c85bf8d6d818df512926f8 100644 |
--- a/components/plugins/renderer/webview_plugin.cc |
+++ b/components/plugins/renderer/webview_plugin.cc |
@@ -68,7 +68,7 @@ WebViewPlugin* WebViewPlugin::Create(content::RenderView* render_view, |
const GURL& url) { |
DCHECK(url.is_valid()) << "Blink requires the WebView to have a valid URL."; |
WebViewPlugin* plugin = new WebViewPlugin(render_view, delegate, preferences); |
- plugin->web_view()->MainFrame()->LoadHTMLString(html_data, url); |
+ plugin->main_frame()->LoadHTMLString(html_data, url); |
return plugin; |
} |
@@ -271,6 +271,13 @@ WebViewPlugin::WebViewHelper::~WebViewHelper() { |
web_view_->Close(); |
} |
+blink::WebLocalFrame* WebViewPlugin::WebViewHelper::main_frame() { |
+ // WebViewHelper doesn't support OOPIFs so the main frame will |
+ // always be local. |
+ DCHECK(web_view_->MainFrame()->IsWebLocalFrame()); |
+ return static_cast<WebLocalFrame*>(web_view_->MainFrame()); |
+} |
+ |
bool WebViewPlugin::WebViewHelper::AcceptsLoadDrops() { |
return false; |
} |
@@ -296,11 +303,7 @@ void WebViewPlugin::WebViewHelper::StartDragging(blink::WebReferrerPolicy, |
const WebImage&, |
const WebPoint&) { |
// Immediately stop dragging. |
- DCHECK(web_view_->MainFrame()->IsWebLocalFrame()); |
- web_view_->MainFrame() |
- ->ToWebLocalFrame() |
- ->FrameWidget() |
- ->DragSourceSystemDragEnded(); |
+ main_frame()->FrameWidget()->DragSourceSystemDragEnded(); |
} |
bool WebViewPlugin::WebViewHelper::AllowsBrokenNullLayerTreeView() const { |
@@ -345,8 +348,7 @@ void WebViewPlugin::WebViewHelper::DidClearWindowObject() { |
v8::Isolate* isolate = blink::MainThreadIsolate(); |
v8::HandleScope handle_scope(isolate); |
- v8::Local<v8::Context> context = |
- web_view_->MainFrame()->MainWorldScriptContext(); |
+ v8::Local<v8::Context> context = main_frame()->MainWorldScriptContext(); |
DCHECK(!context.IsEmpty()); |
v8::Context::Scope context_scope(context); |