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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
354 is_subframe_(false), | 354 is_subframe_(false), |
355 force_disable_overscroll_content_(false), | 355 force_disable_overscroll_content_(false), |
356 last_dialog_suppressed_(false), | 356 last_dialog_suppressed_(false), |
357 geolocation_service_context_(new GeolocationServiceContext()), | 357 geolocation_service_context_(new GeolocationServiceContext()), |
358 accessibility_mode_( | 358 accessibility_mode_( |
359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
360 audio_stream_monitor_(this), | 360 audio_stream_monitor_(this), |
361 bluetooth_device_connected_(false), | 361 bluetooth_device_connected_(false), |
362 virtual_keyboard_requested_(false), | 362 virtual_keyboard_requested_(false), |
363 page_scale_factor_is_one_(true), | 363 page_scale_factor_is_one_(true), |
364 view_with_active_text_input_(nullptr), | |
364 loading_weak_factory_(this), | 365 loading_weak_factory_(this), |
365 weak_factory_(this) { | 366 weak_factory_(this) { |
366 frame_tree_.SetFrameRemoveListener( | 367 frame_tree_.SetFrameRemoveListener( |
367 base::Bind(&WebContentsImpl::OnFrameRemoved, | 368 base::Bind(&WebContentsImpl::OnFrameRemoved, |
368 base::Unretained(this))); | 369 base::Unretained(this))); |
369 #if defined(OS_ANDROID) | 370 #if defined(OS_ANDROID) |
370 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 371 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
371 #else | 372 #else |
372 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 373 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
373 #endif | 374 #endif |
(...skipping 1859 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 && | |
Charlie Reis
2016/03/30 21:52:47
Is this comparison the only reason we need view_wi
EhsanK
2016/03/30 23:36:33
This makes a lot of sense...thanks! Following our
| |
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 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4836 else | 4869 else |
4837 WasHidden(); | 4870 WasHidden(); |
4838 } | 4871 } |
4839 | 4872 |
4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4873 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4841 JavaScriptDialogManager* dialog_manager) { | 4874 JavaScriptDialogManager* dialog_manager) { |
4842 dialog_manager_ = dialog_manager; | 4875 dialog_manager_ = dialog_manager; |
4843 } | 4876 } |
4844 | 4877 |
4845 } // namespace content | 4878 } // namespace content |
OLD | NEW |