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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "content/browser/media/media_web_contents_observer.h" | 58 #include "content/browser/media/media_web_contents_observer.h" |
59 #include "content/browser/media/session/media_session.h" | 59 #include "content/browser/media/session/media_session.h" |
60 #include "content/browser/message_port_message_filter.h" | 60 #include "content/browser/message_port_message_filter.h" |
61 #include "content/browser/plugin_content_origin_whitelist.h" | 61 #include "content/browser/plugin_content_origin_whitelist.h" |
62 #include "content/browser/renderer_host/render_process_host_impl.h" | 62 #include "content/browser/renderer_host/render_process_host_impl.h" |
63 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 63 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
64 #include "content/browser/renderer_host/render_view_host_impl.h" | 64 #include "content/browser/renderer_host/render_view_host_impl.h" |
65 #include "content/browser/renderer_host/render_widget_host_impl.h" | 65 #include "content/browser/renderer_host/render_widget_host_impl.h" |
66 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 66 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
67 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 67 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 68 #include "content/browser/renderer_host/text_input_manager.h" |
68 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_
impl.h" | 69 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host_
impl.h" |
69 #include "content/browser/site_instance_impl.h" | 70 #include "content/browser/site_instance_impl.h" |
70 #include "content/browser/wake_lock/wake_lock_service_context.h" | 71 #include "content/browser/wake_lock/wake_lock_service_context.h" |
71 #include "content/browser/web_contents/web_contents_view_child_frame.h" | 72 #include "content/browser/web_contents/web_contents_view_child_frame.h" |
72 #include "content/browser/web_contents/web_contents_view_guest.h" | 73 #include "content/browser/web_contents/web_contents_view_guest.h" |
73 #include "content/browser/webui/generic_handler.h" | 74 #include "content/browser/webui/generic_handler.h" |
74 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 75 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
75 #include "content/browser/webui/web_ui_impl.h" | 76 #include "content/browser/webui/web_ui_impl.h" |
76 #include "content/common/browser_plugin/browser_plugin_constants.h" | 77 #include "content/common/browser_plugin/browser_plugin_constants.h" |
77 #include "content/common/browser_plugin/browser_plugin_messages.h" | 78 #include "content/common/browser_plugin/browser_plugin_messages.h" |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 render_manager->CreateOuterDelegateProxy( | 1408 render_manager->CreateOuterDelegateProxy( |
1408 outer_contents_frame->GetSiteInstance(), | 1409 outer_contents_frame->GetSiteInstance(), |
1409 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); | 1410 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); |
1410 | 1411 |
1411 render_manager->SetRWHViewForInnerContents( | 1412 render_manager->SetRWHViewForInnerContents( |
1412 render_manager->GetRenderWidgetHostView()); | 1413 render_manager->GetRenderWidgetHostView()); |
1413 | 1414 |
1414 static_cast<RenderWidgetHostViewChildFrame*>( | 1415 static_cast<RenderWidgetHostViewChildFrame*>( |
1415 render_manager->GetRenderWidgetHostView()) | 1416 render_manager->GetRenderWidgetHostView()) |
1416 ->RegisterSurfaceNamespaceId(); | 1417 ->RegisterSurfaceNamespaceId(); |
| 1418 |
| 1419 // At this point, we should destroy the TextInputManager which will notify all |
| 1420 // the RWHV in this WebContents. The RWHV in this WebContents should use the |
| 1421 // TextInputManager owned by the outer WebContents. |
| 1422 // TODO(ekaramad): Is it possible to have TextInputState before attaching to |
| 1423 // outer WebContents? In such a case, is this still the right way to hand off |
| 1424 // state tracking from inner WebContents's TextInputManager to that of the |
| 1425 // outer WebContent (crbug.com/609846)? |
| 1426 text_input_manager_.reset(nullptr); |
1417 } | 1427 } |
1418 | 1428 |
1419 void WebContentsImpl::Stop() { | 1429 void WebContentsImpl::Stop() { |
1420 for (FrameTreeNode* node : frame_tree_.Nodes()) | 1430 for (FrameTreeNode* node : frame_tree_.Nodes()) |
1421 node->StopLoading(); | 1431 node->StopLoading(); |
1422 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); | 1432 FOR_EACH_OBSERVER(WebContentsObserver, observers_, NavigationStopped()); |
1423 } | 1433 } |
1424 | 1434 |
1425 WebContents* WebContentsImpl::Clone() { | 1435 WebContents* WebContentsImpl::Clone() { |
1426 // We use our current SiteInstance since the cloned entry will use it anyway. | 1436 // We use our current SiteInstance since the cloned entry will use it anyway. |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2357 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); | 2367 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView()); |
2358 if (rwhv) { | 2368 if (rwhv) { |
2359 SendPageMessage(new PageMsg_UpdateWindowScreenRect( | 2369 SendPageMessage(new PageMsg_UpdateWindowScreenRect( |
2360 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); | 2370 MSG_ROUTING_NONE, rwhv->GetBoundsInRootWindow())); |
2361 } | 2371 } |
2362 | 2372 |
2363 if (browser_plugin_embedder_) | 2373 if (browser_plugin_embedder_) |
2364 browser_plugin_embedder_->DidSendScreenRects(); | 2374 browser_plugin_embedder_->DidSendScreenRects(); |
2365 } | 2375 } |
2366 | 2376 |
| 2377 TextInputManager* WebContentsImpl::GetTextInputManager() { |
| 2378 if (GetOuterWebContents()) |
| 2379 return GetOuterWebContents()->GetTextInputManager(); |
| 2380 |
| 2381 if (!text_input_manager_) |
| 2382 text_input_manager_.reset(new TextInputManager()); |
| 2383 |
| 2384 return text_input_manager_.get(); |
| 2385 } |
| 2386 |
2367 BrowserAccessibilityManager* | 2387 BrowserAccessibilityManager* |
2368 WebContentsImpl::GetRootBrowserAccessibilityManager() { | 2388 WebContentsImpl::GetRootBrowserAccessibilityManager() { |
2369 RenderFrameHostImpl* rfh = GetMainFrame(); | 2389 RenderFrameHostImpl* rfh = GetMainFrame(); |
2370 return rfh ? rfh->browser_accessibility_manager() : nullptr; | 2390 return rfh ? rfh->browser_accessibility_manager() : nullptr; |
2371 } | 2391 } |
2372 | 2392 |
2373 BrowserAccessibilityManager* | 2393 BrowserAccessibilityManager* |
2374 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2394 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2375 RenderFrameHostImpl* rfh = GetMainFrame(); | 2395 RenderFrameHostImpl* rfh = GetMainFrame(); |
2376 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; | 2396 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : nullptr; |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5033 for (RenderViewHost* render_view_host : render_view_host_set) | 5053 for (RenderViewHost* render_view_host : render_view_host_set) |
5034 render_view_host->OnWebkitPreferencesChanged(); | 5054 render_view_host->OnWebkitPreferencesChanged(); |
5035 } | 5055 } |
5036 | 5056 |
5037 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5057 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
5038 JavaScriptDialogManager* dialog_manager) { | 5058 JavaScriptDialogManager* dialog_manager) { |
5039 dialog_manager_ = dialog_manager; | 5059 dialog_manager_ = dialog_manager; |
5040 } | 5060 } |
5041 | 5061 |
5042 } // namespace content | 5062 } // namespace content |
OLD | NEW |