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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 fullscreen_widget_had_focus_at_shutdown_(false), | 356 fullscreen_widget_had_focus_at_shutdown_(false), |
357 is_subframe_(false), | 357 is_subframe_(false), |
358 force_disable_overscroll_content_(false), | 358 force_disable_overscroll_content_(false), |
359 last_dialog_suppressed_(false), | 359 last_dialog_suppressed_(false), |
360 geolocation_service_context_(new GeolocationServiceContext()), | 360 geolocation_service_context_(new GeolocationServiceContext()), |
361 accessibility_mode_( | 361 accessibility_mode_( |
362 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 362 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
363 audio_stream_monitor_(this), | 363 audio_stream_monitor_(this), |
364 virtual_keyboard_requested_(false), | 364 virtual_keyboard_requested_(false), |
365 page_scale_factor_is_one_(true), | 365 page_scale_factor_is_one_(true), |
| 366 view_with_active_text_input_(nullptr), |
366 loading_weak_factory_(this), | 367 loading_weak_factory_(this), |
367 weak_factory_(this) { | 368 weak_factory_(this) { |
368 frame_tree_.SetFrameRemoveListener( | 369 frame_tree_.SetFrameRemoveListener( |
369 base::Bind(&WebContentsImpl::OnFrameRemoved, | 370 base::Bind(&WebContentsImpl::OnFrameRemoved, |
370 base::Unretained(this))); | 371 base::Unretained(this))); |
371 #if defined(OS_ANDROID) | 372 #if defined(OS_ANDROID) |
372 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 373 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
373 #else | 374 #else |
374 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 375 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
375 #endif | 376 #endif |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2234 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
2234 if (rwhv) { | 2235 if (rwhv) { |
2235 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2236 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
2236 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2237 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
2237 } | 2238 } |
2238 | 2239 |
2239 if (browser_plugin_embedder_) | 2240 if (browser_plugin_embedder_) |
2240 browser_plugin_embedder_->DidSendScreenRects(); | 2241 browser_plugin_embedder_->DidSendScreenRects(); |
2241 } | 2242 } |
2242 | 2243 |
| 2244 TextInputState WebContentsImpl::GetTextInputState() { |
| 2245 if (GetOuterWebContents()) |
| 2246 return GetOuterWebContents()->GetTextInputState(); |
| 2247 return text_input_state_; |
| 2248 } |
| 2249 |
| 2250 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
| 2251 bool text_input_state_changed) { |
| 2252 // If there is an outer WebContents, let it process this update. |
| 2253 if (GetOuterWebContents()) { |
| 2254 return GetOuterWebContents()->UpdateTextInputState( |
| 2255 rwhv, text_input_state_changed); |
| 2256 } |
| 2257 |
| 2258 // If this RWHV has a text input type of NONE, then there is nothing to |
| 2259 // report to the tab RWHV. |
| 2260 if (view_with_active_text_input_ != rwhv && |
| 2261 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
| 2262 return; |
| 2263 |
| 2264 view_with_active_text_input_ = |
| 2265 (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) ? rwhv |
| 2266 : nullptr; |
| 2267 text_input_state_ = *rwhv->text_input_state(); |
| 2268 |
| 2269 // The top level RWHV should know about the change. |
| 2270 RenderWidgetHostViewBase* tab_rwhv = |
| 2271 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2272 if (tab_rwhv) |
| 2273 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
| 2274 } |
| 2275 |
2243 BrowserAccessibilityManager* | 2276 BrowserAccessibilityManager* |
2244 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2277 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
2245 RenderFrameHostImpl* rfh = GetMainFrame(); | 2278 RenderFrameHostImpl* rfh = GetMainFrame(); |
2246 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2279 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
2247 } | 2280 } |
2248 | 2281 |
2249 BrowserAccessibilityManager* | 2282 BrowserAccessibilityManager* |
2250 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2283 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2251 RenderFrameHostImpl* rfh = GetMainFrame(); | 2284 RenderFrameHostImpl* rfh = GetMainFrame(); |
2252 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2285 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
(...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4860 else | 4893 else |
4861 WasHidden(); | 4894 WasHidden(); |
4862 } | 4895 } |
4863 | 4896 |
4864 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4897 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4865 JavaScriptDialogManager* dialog_manager) { | 4898 JavaScriptDialogManager* dialog_manager) { |
4866 dialog_manager_ = dialog_manager; | 4899 dialog_manager_ = dialog_manager; |
4867 } | 4900 } |
4868 | 4901 |
4869 } // namespace content | 4902 } // namespace content |
OLD | NEW |