Chromium Code Reviews| 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..97a483b846130570ea495c4a980c20c66b0970e3 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() { |
| + // The main frame is created in the constructor of WebViewHelper |
| + // - this will always be a local frame. |
|
Łukasz Anforowicz
2017/06/05 17:10:57
I am not sure if the comment above is sufficient -
dcheng
2017/06/05 18:20:51
Maybe just say that WebViewHelper doesn't support
Łukasz Anforowicz
2017/06/05 19:02:38
Done.
|
| + 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); |