| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "content/browser/webui/generic_handler.h" | 72 #include "content/browser/webui/generic_handler.h" |
| 73 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 73 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 74 #include "content/browser/webui/web_ui_impl.h" | 74 #include "content/browser/webui/web_ui_impl.h" |
| 75 #include "content/common/browser_plugin/browser_plugin_constants.h" | 75 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 76 #include "content/common/browser_plugin/browser_plugin_messages.h" | 76 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 77 #include "content/common/frame_messages.h" | 77 #include "content/common/frame_messages.h" |
| 78 #include "content/common/input_messages.h" | 78 #include "content/common/input_messages.h" |
| 79 #include "content/common/page_messages.h" | 79 #include "content/common/page_messages.h" |
| 80 #include "content/common/site_isolation_policy.h" | 80 #include "content/common/site_isolation_policy.h" |
| 81 #include "content/common/ssl_status_serialization.h" | 81 #include "content/common/ssl_status_serialization.h" |
| 82 #include "content/common/text_input_state.h" | |
| 83 #include "content/common/view_messages.h" | 82 #include "content/common/view_messages.h" |
| 84 #include "content/public/browser/ax_event_notification_details.h" | 83 #include "content/public/browser/ax_event_notification_details.h" |
| 85 #include "content/public/browser/browser_context.h" | 84 #include "content/public/browser/browser_context.h" |
| 86 #include "content/public/browser/browser_plugin_guest_manager.h" | 85 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 87 #include "content/public/browser/content_browser_client.h" | 86 #include "content/public/browser/content_browser_client.h" |
| 88 #include "content/public/browser/devtools_agent_host.h" | 87 #include "content/public/browser/devtools_agent_host.h" |
| 89 #include "content/public/browser/download_manager.h" | 88 #include "content/public/browser/download_manager.h" |
| 90 #include "content/public/browser/download_url_parameters.h" | 89 #include "content/public/browser/download_url_parameters.h" |
| 91 #include "content/public/browser/invalidate_type.h" | 90 #include "content/public/browser/invalidate_type.h" |
| 92 #include "content/public/browser/javascript_dialog_manager.h" | 91 #include "content/public/browser/javascript_dialog_manager.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 is_subframe_(false), | 395 is_subframe_(false), |
| 397 force_disable_overscroll_content_(false), | 396 force_disable_overscroll_content_(false), |
| 398 last_dialog_suppressed_(false), | 397 last_dialog_suppressed_(false), |
| 399 geolocation_service_context_(new GeolocationServiceContext()), | 398 geolocation_service_context_(new GeolocationServiceContext()), |
| 400 accessibility_mode_( | 399 accessibility_mode_( |
| 401 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), | 400 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()), |
| 402 audio_stream_monitor_(this), | 401 audio_stream_monitor_(this), |
| 403 bluetooth_connected_device_count_(0), | 402 bluetooth_connected_device_count_(0), |
| 404 virtual_keyboard_requested_(false), | 403 virtual_keyboard_requested_(false), |
| 405 page_scale_factor_is_one_(true), | 404 page_scale_factor_is_one_(true), |
| 406 text_input_state_(new TextInputState()), | |
| 407 loading_weak_factory_(this), | 405 loading_weak_factory_(this), |
| 408 weak_factory_(this) { | 406 weak_factory_(this) { |
| 409 frame_tree_.SetFrameRemoveListener( | 407 frame_tree_.SetFrameRemoveListener( |
| 410 base::Bind(&WebContentsImpl::OnFrameRemoved, | 408 base::Bind(&WebContentsImpl::OnFrameRemoved, |
| 411 base::Unretained(this))); | 409 base::Unretained(this))); |
| 412 #if defined(OS_ANDROID) | 410 #if defined(OS_ANDROID) |
| 413 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); | 411 media_web_contents_observer_.reset(new MediaWebContentsObserverAndroid(this)); |
| 414 #else | 412 #else |
| 415 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); | 413 media_web_contents_observer_.reset(new MediaWebContentsObserver(this)); |
| 416 #endif | 414 #endif |
| (...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2298 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
| 2301 if (rwhv) { | 2299 if (rwhv) { |
| 2302 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2300 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
| 2303 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2301 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
| 2304 } | 2302 } |
| 2305 | 2303 |
| 2306 if (browser_plugin_embedder_) | 2304 if (browser_plugin_embedder_) |
| 2307 browser_plugin_embedder_->DidSendScreenRects(); | 2305 browser_plugin_embedder_->DidSendScreenRects(); |
| 2308 } | 2306 } |
| 2309 | 2307 |
| 2310 const TextInputState* WebContentsImpl::GetTextInputState() { | |
| 2311 if (GetOuterWebContents()) | |
| 2312 return GetOuterWebContents()->GetTextInputState(); | |
| 2313 // A RWHV should update WebContentsImpl in its destruction path so that state | |
| 2314 // type is reset to none. | |
| 2315 DCHECK(view_with_active_text_input_ || | |
| 2316 text_input_state_->type == ui::TEXT_INPUT_TYPE_NONE); | |
| 2317 return text_input_state_.get(); | |
| 2318 } | |
| 2319 | |
| 2320 void WebContentsImpl::UpdateTextInputState(RenderWidgetHostViewBase* rwhv, | |
| 2321 bool text_input_state_changed) { | |
| 2322 // If there is an outer WebContents, let it process this update. | |
| 2323 if (GetOuterWebContents()) { | |
| 2324 return GetOuterWebContents()->UpdateTextInputState( | |
| 2325 rwhv, text_input_state_changed); | |
| 2326 } | |
| 2327 | |
| 2328 // If this RWHV has a text input type of NONE, then there is nothing to | |
| 2329 // report to the tab RWHV. | |
| 2330 if (view_with_active_text_input_.get() != rwhv && | |
| 2331 rwhv->text_input_state()->type == ui::TEXT_INPUT_TYPE_NONE) | |
| 2332 return; | |
| 2333 | |
| 2334 if (rwhv->text_input_state()->type != ui::TEXT_INPUT_TYPE_NONE) | |
| 2335 view_with_active_text_input_ = rwhv->GetWeakPtr(); | |
| 2336 else | |
| 2337 view_with_active_text_input_.reset(); | |
| 2338 | |
| 2339 *text_input_state_ = *rwhv->text_input_state(); | |
| 2340 | |
| 2341 // The top level RWHV should know about the change. | |
| 2342 RenderWidgetHostViewBase* tab_rwhv = | |
| 2343 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | |
| 2344 if (tab_rwhv) | |
| 2345 tab_rwhv->UpdateInputMethodIfNecessary(text_input_state_changed); | |
| 2346 } | |
| 2347 | |
| 2348 BrowserAccessibilityManager* | 2308 BrowserAccessibilityManager* |
| 2349 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2309 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
| 2350 RenderFrameHostImpl* rfh = GetMainFrame(); | 2310 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2351 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2311 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
| 2352 } | 2312 } |
| 2353 | 2313 |
| 2354 BrowserAccessibilityManager* | 2314 BrowserAccessibilityManager* |
| 2355 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2315 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
| 2356 RenderFrameHostImpl* rfh = GetMainFrame(); | 2316 RenderFrameHostImpl* rfh = GetMainFrame(); |
| 2357 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2317 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5001 for (RenderViewHost* render_view_host : render_view_host_set) | 4961 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5002 render_view_host->OnWebkitPreferencesChanged(); | 4962 render_view_host->OnWebkitPreferencesChanged(); |
| 5003 } | 4963 } |
| 5004 | 4964 |
| 5005 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4965 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5006 JavaScriptDialogManager* dialog_manager) { | 4966 JavaScriptDialogManager* dialog_manager) { |
| 5007 dialog_manager_ = dialog_manager; | 4967 dialog_manager_ = dialog_manager; |
| 5008 } | 4968 } |
| 5009 | 4969 |
| 5010 } // namespace content | 4970 } // namespace content |
| OLD | NEW |