| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "content/browser/webui/generic_handler.h" | 70 #include "content/browser/webui/generic_handler.h" |
| 71 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 71 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 72 #include "content/browser/webui/web_ui_impl.h" | 72 #include "content/browser/webui/web_ui_impl.h" |
| 73 #include "content/common/browser_plugin/browser_plugin_constants.h" | 73 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 74 #include "content/common/browser_plugin/browser_plugin_messages.h" | 74 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 75 #include "content/common/frame_messages.h" | 75 #include "content/common/frame_messages.h" |
| 76 #include "content/common/input_messages.h" | 76 #include "content/common/input_messages.h" |
| 77 #include "content/common/page_messages.h" | 77 #include "content/common/page_messages.h" |
| 78 #include "content/common/site_isolation_policy.h" | 78 #include "content/common/site_isolation_policy.h" |
| 79 #include "content/common/ssl_status_serialization.h" | 79 #include "content/common/ssl_status_serialization.h" |
| 80 #include "content/common/text_input_state.h" |
| 80 #include "content/common/view_messages.h" | 81 #include "content/common/view_messages.h" |
| 81 #include "content/public/browser/ax_event_notification_details.h" | 82 #include "content/public/browser/ax_event_notification_details.h" |
| 82 #include "content/public/browser/browser_context.h" | 83 #include "content/public/browser/browser_context.h" |
| 83 #include "content/public/browser/browser_plugin_guest_manager.h" | 84 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 84 #include "content/public/browser/content_browser_client.h" | 85 #include "content/public/browser/content_browser_client.h" |
| 85 #include "content/public/browser/devtools_agent_host.h" | 86 #include "content/public/browser/devtools_agent_host.h" |
| 86 #include "content/public/browser/download_manager.h" | 87 #include "content/public/browser/download_manager.h" |
| 87 #include "content/public/browser/download_url_parameters.h" | 88 #include "content/public/browser/download_url_parameters.h" |
| 88 #include "content/public/browser/invalidate_type.h" | 89 #include "content/public/browser/invalidate_type.h" |
| 89 #include "content/public/browser/javascript_dialog_manager.h" | 90 #include "content/public/browser/javascript_dialog_manager.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 is_subframe_(false), | 355 is_subframe_(false), |
| 355 force_disable_overscroll_content_(false), | 356 force_disable_overscroll_content_(false), |
| 356 last_dialog_suppressed_(false), | 357 last_dialog_suppressed_(false), |
| 357 geolocation_service_context_(new GeolocationServiceContext()), | 358 geolocation_service_context_(new GeolocationServiceContext()), |
| 358 accessibility_mode_( | 359 accessibility_mode_( |
| 359 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 360 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
| 360 audio_stream_monitor_(this), | 361 audio_stream_monitor_(this), |
| 361 bluetooth_device_connected_(false), | 362 bluetooth_device_connected_(false), |
| 362 virtual_keyboard_requested_(false), | 363 virtual_keyboard_requested_(false), |
| 363 page_scale_factor_is_one_(true), | 364 page_scale_factor_is_one_(true), |
| 365 text_input_state_(new TextInputState()), |
| 364 loading_weak_factory_(this), | 366 loading_weak_factory_(this), |
| 365 weak_factory_(this) { | 367 weak_factory_(this) { |
| 366 frame_tree_.SetFrameRemoveListener( | 368 frame_tree_.SetFrameRemoveListener( |
| 367 base::Bind(&WebContentsImpl::OnFrameRemoved, | 369 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 368 base::Unretained(this))); | 370 base::Unretained(this))); |
| 369 #if defined(OS_ANDROID) | 371 #if defined(OS_ANDROID) |
| 370 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 372 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
| 371 #else | 373 #else |
| 372 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 374 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
| 373 #endif | 375 #endif |
| (...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2242 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2241 if (rwhv) { | 2243 if (rwhv) { |
| 2242 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2244 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
| 2243 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2245 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
| 2244 } | 2246 } |
| 2245 | 2247 |
| 2246 if (browser_plugin_embedder_) | 2248 if (browser_plugin_embedder_) |
| 2247 browser_plugin_embedder_->DidSendScreenRects(); | 2249 browser_plugin_embedder_->DidSendScreenRects(); |
| 2248 } | 2250 } |
| 2249 | 2251 |
| 2252 const TextInputState* WebContentsImpl::GetTextInputState() { |
| 2253 if (GetOuterWebContents()) |
| 2254 return GetOuterWebContents()->GetTextInputState(); |
| 2255 // A RWHV should update WebContentsImpl in its destruction path so that state |
| 2256 // type is reset to none. |
| 2257 DCHECK(view_with_active_text_input_ || |
| 2258 text_input_state_->type == ui::TEXT_INPUT_TYPE_NONE); |
| 2259 return text_input_state_.get(); |
| 2260 } |
| 2261 |
| 2262 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, |
| 2263 bool text_input_state_changed) { |
| 2264 // If there is an outer WebContents, let it process this update. |
| 2265 if (GetOuterWebContents()) { |
| 2266 return GetOuterWebContents()->UpdateTextInputState( |
| 2267 rwhv, text_input_state_changed); |
| 2268 } |
| 2269 |
| 2270 // If this RWHV has a text input type of NONE, then there is nothing to |
| 2271 // report to the tab RWHV. |
| 2272 if (view_with_active_text_input_.get() != rwhv && |
| 2273 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) |
| 2274 return; |
| 2275 |
| 2276 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) |
| 2277 view_with_active_text_input_ = rwhv->GetWeakPtr(); |
| 2278 else |
| 2279 view_with_active_text_input_.reset(); |
| 2280 |
| 2281 *text_input_state_ = *rwhv->text_input_state(); |
| 2282 |
| 2283 // The top level RWHV should know about the change. |
| 2284 RenderWidgetHostViewBase* tab_rwhv = |
| 2285 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2286 if (tab_rwhv) |
| 2287 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); |
| 2288 } |
| 2289 |
| 2250 BrowserAccessibilityManager* | 2290 BrowserAccessibilityManager* |
| 2251 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2291 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 2252 RenderFrameHostImpl* rfh = GetMainFrame(); | 2292 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2253 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2293 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
| 2254 } | 2294 } |
| 2255 | 2295 |
| 2256 BrowserAccessibilityManager* | 2296 BrowserAccessibilityManager* |
| 2257 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2297 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 2258 RenderFrameHostImpl* rfh = GetMainFrame(); | 2298 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2259 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2299 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
| (...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4846 else | 4886 else |
| 4847 WasHidden(); | 4887 WasHidden(); |
| 4848 } | 4888 } |
| 4849 | 4889 |
| 4850 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4890 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4851 JavaScriptDialogManager* dialog_manager) { | 4891 JavaScriptDialogManager* dialog_manager) { |
| 4852 dialog_manager_ = dialog_manager; | 4892 dialog_manager_ = dialog_manager; |
| 4853 } | 4893 } |
| 4854 | 4894 |
| 4855 } // namespace content | 4895 } // namespace content |
| OLD | NEW |