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