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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2233 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
2234 if (rwhv) { | 2234 if (rwhv) { |
2235 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2235 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
2236 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2236 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
2237 } | 2237 } |
2238 | 2238 |
2239 if (browser_plugin_embedder_) | 2239 if (browser_plugin_embedder_) |
2240 browser_plugin_embedder_->DidSendScreenRects(); | 2240 browser_plugin_embedder_->DidSendScreenRects(); |
2241 } | 2241 } |
2242 | 2242 |
| 2243 TextInputState WebContentsImpl::GetTextInputState() { |
| 2244 if (GetOuterWebContents()) |
| 2245 return GetOuterWebContents()->GetTextInputState(); |
| 2246 // A RWHV should update WebContentsImpl in its destruction path so that state |
| 2247 // type is reset to none. |
| 2248 DCHECK(view_with_active_text_input_ || |
| 2249 text_input_state_.type == ui::TEXT_INPUT_TYPE_NONE); |
| 2250 return text_input_state_; |
| 2251 } |
| 2252 |
| 2253 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
| 2254 bool text_input_state_changed) { |
| 2255 // If there is an outer WebContents, let it process this update. |
| 2256 if (GetOuterWebContents()) { |
| 2257 return GetOuterWebContents()->UpdateTextInputState( |
| 2258 rwhv, text_input_state_changed); |
| 2259 } |
| 2260 |
| 2261 // If this RWHV has a text input type of NONE, then there is nothing to |
| 2262 // report to the tab RWHV. |
| 2263 if (view_with_active_text_input_.get() != rwhv && |
| 2264 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
| 2265 return; |
| 2266 |
| 2267 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) |
| 2268 view_with_active_text_input_ = rwhv->GetWeakPtr(); |
| 2269 else |
| 2270 view_with_active_text_input_.reset(); |
| 2271 |
| 2272 text_input_state_ = *rwhv->text_input_state(); |
| 2273 |
| 2274 // The top level RWHV should know about the change. |
| 2275 RenderWidgetHostViewBase* tab_rwhv = |
| 2276 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2277 if (tab_rwhv) |
| 2278 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
| 2279 } |
| 2280 |
2243 BrowserAccessibilityManager* | 2281 BrowserAccessibilityManager* |
2244 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2282 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
2245 RenderFrameHostImpl* rfh = GetMainFrame(); | 2283 RenderFrameHostImpl* rfh = GetMainFrame(); |
2246 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2284 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
2247 } | 2285 } |
2248 | 2286 |
2249 BrowserAccessibilityManager* | 2287 BrowserAccessibilityManager* |
2250 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2288 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2251 RenderFrameHostImpl* rfh = GetMainFrame(); | 2289 RenderFrameHostImpl* rfh = GetMainFrame(); |
2252 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2290 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4836 else | 4874 else |
4837 WasHidden(); | 4875 WasHidden(); |
4838 } | 4876 } |
4839 | 4877 |
4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4878 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4841 JavaScriptDialogManager* dialog_manager) { | 4879 JavaScriptDialogManager* dialog_manager) { |
4842 dialog_manager_ = dialog_manager; | 4880 dialog_manager_ = dialog_manager; |
4843 } | 4881 } |
4844 | 4882 |
4845 } // namespace content | 4883 } // namespace content |
OLD | NEW |