Chromium Code Reviews| Index: ui/views/controls/webview/webview.cc |
| diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc |
| index 6eb474020e9a4f4ef369cec93f01d1d4017acd42..ea8e875f29437aa35f88f262cb25720e08907bdd 100644 |
| --- a/ui/views/controls/webview/webview.cc |
| +++ b/ui/views/controls/webview/webview.cc |
| @@ -271,8 +271,7 @@ void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) { |
| void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, |
| content::RenderViewHost* new_host) { |
| - FocusManager* const focus_manager = GetFocusManager(); |
| - if (focus_manager && focus_manager->GetFocusedView() == this) |
| + if (HasFocus()) |
| OnFocus(); |
| NotifyAccessibilityWebContentsChanged(); |
| } |
| @@ -310,9 +309,7 @@ void WebView::DidDetachInterstitialPage() { |
| } |
| void WebView::OnWebContentsFocused() { |
| - FocusManager* focus_manager = GetFocusManager(); |
| - if (focus_manager) |
| - focus_manager->SetFocusedView(this); |
| + RequestFocus(); |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| @@ -333,11 +330,9 @@ void WebView::AttachWebContents() { |
| holder_->Attach(view_to_attach); |
| - // The view will not be focused automatically when it is attached, so we need |
| - // to pass on focus to it if the FocusManager thinks the view is focused. Note |
| - // that not every Widget has a focus manager. |
| - FocusManager* const focus_manager = GetFocusManager(); |
| - if (focus_manager && focus_manager->GetFocusedView() == this) |
| + // The WebContents will not be focused automatically when it is attached, so |
| + // we need to pass on focus to if focused. |
|
msw
2017/03/10 17:47:08
nit: clarify 'pass on focus to if focused'?
sky
2017/03/10 18:06:11
Done.
|
| + if (HasFocus()) |
| OnFocus(); |
| OnWebContentsAttached(); |