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 4669c3ede4ac7a7827438711ee68e7c71d9de163..c134301b59bce2f5155e2bdcb86b56c4f4f69381 100644 |
| --- a/ui/views/controls/webview/webview.cc |
| +++ b/ui/views/controls/webview/webview.cc |
| @@ -14,6 +14,7 @@ |
| #include "ipc/ipc_message.h" |
| #include "ui/accessibility/ax_enums.h" |
| #include "ui/accessibility/ax_view_state.h" |
| +#include "ui/base/ui_base_switches_util.h" |
| #include "ui/events/event.h" |
| #include "ui/views/accessibility/native_view_accessibility.h" |
| #include "ui/views/controls/native/native_view_host.h" |
| @@ -156,6 +157,19 @@ void WebView::AboutToRequestFocusFromTabTraversal(bool reverse) { |
| web_contents()->FocusThroughTabTraversal(reverse); |
| } |
| +ui::TextInputClient* WebView::GetTextInputClient() { |
| + if (!switches::IsNewTextInputFocusEnabled()) |
|
msw
2014/03/11 00:58:50
nit: just make this condition part of the if state
Yuki
2014/03/11 15:27:37
Done.
|
| + return NULL; |
| + |
| + if (web_contents() && !web_contents()->IsBeingDestroyed()) { |
| + content::RenderWidgetHostView* host_view = |
| + web_contents()->GetRenderWidgetHostView(); |
| + if (host_view) |
| + return host_view->GetTextInputClient(); |
| + } |
| + return NULL; |
| +} |
| + |
| void WebView::GetAccessibleState(ui::AXViewState* state) { |
| state->role = ui::AX_ROLE_GROUP; |
| } |
| @@ -194,6 +208,15 @@ bool WebView::EmbedsFullscreenWidget() const { |
| //////////////////////////////////////////////////////////////////////////////// |
| // WebView, content::WebContentsObserver implementation: |
| +void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) { |
| + // WebView::GetTextInputClient() delegates the text input handling to the |
|
msw
2014/03/11 00:58:50
This comment doesn't explain why you'd want to set
Yuki
2014/03/11 15:27:37
I've updated the comment trying to make it clearer
msw
2014/03/11 23:24:37
That makes sense, thanks for the explanation and c
|
| + // underlying content::RenderWidgetHostView. So when it's destroyed, we have |
| + // to change the focused text input client. |
| + FocusManager* const focus_manager = GetFocusManager(); |
| + if (focus_manager) |
| + focus_manager->OnTextInputClientChanged(this); |
| +} |
| + |
| void WebView::RenderViewHostChanged(content::RenderViewHost* old_host, |
| content::RenderViewHost* new_host) { |
| FocusManager* const focus_manager = GetFocusManager(); |