Chromium Code Reviews| Index: headless/lib/browser/headless_web_contents_impl.cc |
| diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc |
| index 9d4b7add3323b2db989e49f990c62d79346bf0ae..2a2f780bc13412a13766c7f2f4929d851a0a1a11 100644 |
| --- a/headless/lib/browser/headless_web_contents_impl.cc |
| +++ b/headless/lib/browser/headless_web_contents_impl.cc |
| @@ -21,6 +21,8 @@ |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/render_view_host.h" |
| +#include "content/public/browser/render_widget_host.h" |
| +#include "content/public/browser/render_widget_host_view.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| #include "content/public/common/bindings_policy.h" |
| @@ -97,6 +99,10 @@ class HeadlessWebContentsImpl::Delegate : public content::WebContentsDelegate { |
| security_style_explanations); |
| } |
| + void ActivateContents(content::WebContents* contents) override { |
| + contents->GetTopLevelRenderWidgetHostView()->GetRenderWidgetHost()->Focus(); |
|
Eric Seckler
2017/02/21 09:28:02
Hm, the content shell does:
contents->GetRenderV
irisu
2017/02/22 05:34:35
No, I don't. Done.
|
| + } |
| + |
| private: |
| HeadlessBrowserContextImpl* browser_context_; // Not owned. |
| DISALLOW_COPY_AND_ASSIGN(Delegate); |
| @@ -181,6 +187,7 @@ bool HeadlessWebContentsImpl::OpenURL(const GURL& url) { |
| ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| web_contents_->GetController().LoadURLWithParams(params); |
| web_contents_->Focus(); |
| + web_contents_delegate_->ActivateContents(web_contents_.get()); |
|
Eric Seckler
2017/02/21 09:28:02
Ah, okay. I thought ActivateContents would be call
irisu
2017/02/22 05:34:35
Done. I'm getting a presubmit warning for using Te
Eric Seckler
2017/02/22 09:00:03
Yeah, it's a reasonable warning, but given that th
Eric Seckler
2017/02/22 10:28:59
Seems like we'll also have to add a build dependen
|
| return true; |
| } |