Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl.cc |
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
| index 2d463287de60180ff5c1c2e3e3f41c96ae7d9f7b..72a6b05bfe4662f0d511b811cc37d251c65a10ad 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -2240,6 +2240,44 @@ void WebContentsImpl::SendScreenRects() { |
| browser_plugin_embedder_->DidSendScreenRects(); |
| } |
| +TextInputState WebContentsImpl::GetTextInputState() { |
| + if (GetOuterWebContents()) |
| + return GetOuterWebContents()->GetTextInputState(); |
| + // A RWHV should update WebContentsImpl in its destruction path so that that |
|
Charlie Reis
2016/03/31 05:59:16
nit: s/that that/that its/
EhsanK
2016/04/01 00:59:17
Done.
|
| + // state type is reset to none. |
| + DCHECK(!view_with_active_text_input_ && |
|
EhsanK
2016/04/01 00:59:17
Not sure if having a DCHECK like this a good pract
Charlie Reis
2016/04/01 21:24:09
Yes, seems like a good thing to have.
|
| + text_input_state_.type != ui::TEXT_INPUT_TYPE_NONE); |
|
Charlie Reis
2016/03/31 05:59:17
This doesn't look right-- it's saying that we'll c
EhsanK
2016/04/01 00:59:17
You are right. I keep forgetting DCHECK(false) cra
|
| + return text_input_state_; |
| +} |
| + |
| +void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
| + bool text_input_state_changed) { |
| + // If there is an outer WebContents, let it process this update. |
| + if (GetOuterWebContents()) { |
| + return GetOuterWebContents()->UpdateTextInputState( |
| + rwhv, text_input_state_changed); |
| + } |
| + |
| + // If this RWHV has a text input type of NONE, then there is nothing to |
| + // report to the tab RWHV. |
| + if (view_with_active_text_input_.get() != rwhv && |
| + rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
| + return; |
| + |
| + if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) |
| + view_with_active_text_input_ = rwhv->GetWeakPtr(); |
| + else |
| + view_with_active_text_input_.reset(); |
| + |
| + text_input_state_ = *rwhv->text_input_state(); |
| + |
| + // The top level RWHV should know about the change. |
| + RenderWidgetHostViewBase* tab_rwhv = |
| + static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| + if (tab_rwhv) |
| + tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
| +} |
| + |
| BrowserAccessibilityManager* |
| WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| RenderFrameHostImpl* rfh = GetMainFrame(); |