OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2240 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
2241 if (rwhv) { | 2241 if (rwhv) { |
2242 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2242 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
2243 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2243 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
2244 } | 2244 } |
2245 | 2245 |
2246 if (browser_plugin_embedder_) | 2246 if (browser_plugin_embedder_) |
2247 browser_plugin_embedder_->DidSendScreenRects(); | 2247 browser_plugin_embedder_->DidSendScreenRects(); |
2248 } | 2248 } |
2249 | 2249 |
| 2250 TextInputState WebContentsImpl::GetTextInputState() { |
| 2251 if (GetOuterWebContents()) |
| 2252 return GetOuterWebContents()->GetTextInputState(); |
| 2253 // A RWHV should update WebContentsImpl in its destruction path so that state |
| 2254 // type is reset to none. |
| 2255 DCHECK(view_with_active_text_input_ || |
| 2256 text_input_state_.type == ui::TEXT_INPUT_TYPE_NONE); |
| 2257 return text_input_state_; |
| 2258 } |
| 2259 |
| 2260 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
| 2261 bool text_input_state_changed) { |
| 2262 // If there is an outer WebContents, let it process this update. |
| 2263 if (GetOuterWebContents()) { |
| 2264 return GetOuterWebContents()->UpdateTextInputState( |
| 2265 rwhv, text_input_state_changed); |
| 2266 } |
| 2267 |
| 2268 // If this RWHV has a text input type of NONE, then there is nothing to |
| 2269 // report to the tab RWHV. |
| 2270 if (view_with_active_text_input_.get() != rwhv && |
| 2271 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
| 2272 return; |
| 2273 |
| 2274 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) |
| 2275 view_with_active_text_input_ = rwhv->GetWeakPtr(); |
| 2276 else |
| 2277 view_with_active_text_input_.reset(); |
| 2278 |
| 2279 text_input_state_ = *rwhv->text_input_state(); |
| 2280 |
| 2281 // The top level RWHV should know about the change. |
| 2282 RenderWidgetHostViewBase* tab_rwhv = |
| 2283 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2284 if (tab_rwhv) |
| 2285 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
| 2286 } |
| 2287 |
2250 BrowserAccessibilityManager* | 2288 BrowserAccessibilityManager* |
2251 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2289 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
2252 RenderFrameHostImpl* rfh = GetMainFrame(); | 2290 RenderFrameHostImpl* rfh = GetMainFrame(); |
2253 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2291 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
2254 } | 2292 } |
2255 | 2293 |
2256 BrowserAccessibilityManager* | 2294 BrowserAccessibilityManager* |
2257 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2295 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2258 RenderFrameHostImpl* rfh = GetMainFrame(); | 2296 RenderFrameHostImpl* rfh = GetMainFrame(); |
2259 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2297 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4846 else | 4884 else |
4847 WasHidden(); | 4885 WasHidden(); |
4848 } | 4886 } |
4849 | 4887 |
4850 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4888 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4851 JavaScriptDialogManager* dialog_manager) { | 4889 JavaScriptDialogManager* dialog_manager) { |
4852 dialog_manager_ = dialog_manager; | 4890 dialog_manager_ = dialog_manager; |
4853 } | 4891 } |
4854 | 4892 |
4855 } // namespace content | 4893 } // namespace content |
OLD | NEW |