Chromium Code Reviews| 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 GetOuterWebContents()->UpdateTextInputState(rwhv, text_input_state_changed); | |
|
Charlie Reis
2016/03/15 18:32:01
Does this need an early return, or do we need to a
EhsanK
2016/03/15 23:51:18
This too is definitely a bug. I messed this (and t
| |
| 2255 // If this RWHV has a text input type of NONE, then there is nothing to | |
|
Charlie Reis
2016/03/15 18:32:01
nit: Blank line before.
EhsanK
2016/03/15 23:51:18
Done.
| |
| 2256 // report to the tab RWHV. | |
| 2257 if (view_with_active_text_input_ != rwhv && | |
| 2258 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) | |
| 2259 return; | |
| 2260 | |
| 2261 view_with_active_text_input_ = | |
| 2262 (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) ? rwhv | |
| 2263 : nullptr; | |
| 2264 text_input_state_ = *rwhv->text_input_state(); | |
| 2265 | |
| 2266 // The top level RWHV should know about the change. | |
| 2267 RenderWidgetHostViewBase* tab_rwhv = | |
| 2268 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
| 2269 if (tab_rwhv) | |
| 2270 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); | |
| 2271 } | |
| 2272 | |
| 2243 BrowserAccessibilityManager* | 2273 BrowserAccessibilityManager* |
| 2244 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2274 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 2245 RenderFrameHostImpl* rfh = GetMainFrame(); | 2275 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2246 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2276 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
| 2247 } | 2277 } |
| 2248 | 2278 |
| 2249 BrowserAccessibilityManager* | 2279 BrowserAccessibilityManager* |
| 2250 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2280 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 2251 RenderFrameHostImpl* rfh = GetMainFrame(); | 2281 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2252 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2282 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
| (...skipping 2608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4861 else | 4891 else |
| 4862 WasHidden(); | 4892 WasHidden(); |
| 4863 } | 4893 } |
| 4864 | 4894 |
| 4865 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4895 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4866 JavaScriptDialogManager* dialog_manager) { | 4896 JavaScriptDialogManager* dialog_manager) { |
| 4867 dialog_manager_ = dialog_manager; | 4897 dialog_manager_ = dialog_manager; |
| 4868 } | 4898 } |
| 4869 | 4899 |
| 4870 } // namespace content | 4900 } // namespace content |
| OLD | NEW |