| 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 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 // Render{View,Frame}Host must be initialized and the RenderWidgetHostView | 1440 // Render{View,Frame}Host must be initialized and the RenderWidgetHostView |
| 1441 // created. This is needed because the usual initialization happens during | 1441 // created. This is needed because the usual initialization happens during |
| 1442 // the first navigation, but when attaching a new window we don't navigate | 1442 // the first navigation, but when attaching a new window we don't navigate |
| 1443 // before attaching. If the browser side is already initialized, the calls | 1443 // before attaching. If the browser side is already initialized, the calls |
| 1444 // below will just early return. | 1444 // below will just early return. |
| 1445 render_manager->InitRenderView(GetRenderViewHost(), nullptr); | 1445 render_manager->InitRenderView(GetRenderViewHost(), nullptr); |
| 1446 GetMainFrame()->Init(); | 1446 GetMainFrame()->Init(); |
| 1447 if (!render_manager->GetRenderWidgetHostView()) | 1447 if (!render_manager->GetRenderWidgetHostView()) |
| 1448 CreateRenderWidgetHostViewForRenderManager(GetRenderViewHost()); | 1448 CreateRenderWidgetHostViewForRenderManager(GetRenderViewHost()); |
| 1449 | 1449 |
| 1450 auto* outer_web_contents_impl = |
| 1451 static_cast<WebContentsImpl*>(outer_web_contents); |
| 1452 auto* outer_contents_frame_impl = |
| 1453 static_cast<RenderFrameHostImpl*>(outer_contents_frame); |
| 1450 // Create a link to our outer WebContents. | 1454 // Create a link to our outer WebContents. |
| 1451 node_.ConnectToOuterWebContents( | 1455 node_.ConnectToOuterWebContents(outer_web_contents_impl, |
| 1452 static_cast<WebContentsImpl*>(outer_web_contents), | 1456 outer_contents_frame_impl); |
| 1453 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); | |
| 1454 | 1457 |
| 1455 DCHECK(outer_contents_frame); | 1458 DCHECK(outer_contents_frame); |
| 1456 | 1459 |
| 1457 // Create a proxy in top-level RenderFrameHostManager, pointing to the | 1460 // Create a proxy in top-level RenderFrameHostManager, pointing to the |
| 1458 // SiteInstance of the outer WebContents. The proxy will be used to send | 1461 // SiteInstance of the outer WebContents. The proxy will be used to send |
| 1459 // postMessage to the inner WebContents. | 1462 // postMessage to the inner WebContents. |
| 1460 render_manager->CreateOuterDelegateProxy( | 1463 render_manager->CreateOuterDelegateProxy( |
| 1461 outer_contents_frame->GetSiteInstance(), | 1464 outer_contents_frame->GetSiteInstance(), outer_contents_frame_impl); |
| 1462 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); | |
| 1463 | 1465 |
| 1464 render_manager->SetRWHViewForInnerContents( | 1466 render_manager->SetRWHViewForInnerContents( |
| 1465 render_manager->GetRenderWidgetHostView()); | 1467 render_manager->GetRenderWidgetHostView()); |
| 1466 | 1468 |
| 1467 static_cast<RenderWidgetHostViewChildFrame*>( | 1469 static_cast<RenderWidgetHostViewChildFrame*>( |
| 1468 render_manager->GetRenderWidgetHostView()) | 1470 render_manager->GetRenderWidgetHostView()) |
| 1469 ->RegisterFrameSinkId(); | 1471 ->RegisterFrameSinkId(); |
| 1470 | 1472 |
| 1473 if (outer_web_contents_impl->frame_tree_.GetFocusedFrame() == |
| 1474 outer_contents_frame_impl->frame_tree_node()) { |
| 1475 SetFocusedFrame(frame_tree_.root(), nullptr); |
| 1476 } |
| 1477 |
| 1471 // At this point, we should destroy the TextInputManager which will notify all | 1478 // At this point, we should destroy the TextInputManager which will notify all |
| 1472 // the RWHV in this WebContents. The RWHV in this WebContents should use the | 1479 // the RWHV in this WebContents. The RWHV in this WebContents should use the |
| 1473 // TextInputManager owned by the outer WebContents. | 1480 // TextInputManager owned by the outer WebContents. |
| 1474 // TODO(ekaramad): Is it possible to have TextInputState before attaching to | 1481 // TODO(ekaramad): Is it possible to have TextInputState before attaching to |
| 1475 // outer WebContents? In such a case, is this still the right way to hand off | 1482 // outer WebContents? In such a case, is this still the right way to hand off |
| 1476 // state tracking from inner WebContents's TextInputManager to that of the | 1483 // state tracking from inner WebContents's TextInputManager to that of the |
| 1477 // outer WebContent (crbug.com/609846)? | 1484 // outer WebContent (crbug.com/609846)? |
| 1478 text_input_manager_.reset(nullptr); | 1485 text_input_manager_.reset(nullptr); |
| 1479 } | 1486 } |
| 1480 | 1487 |
| (...skipping 3991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5472 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5479 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5473 if (!render_view_host) | 5480 if (!render_view_host) |
| 5474 continue; | 5481 continue; |
| 5475 render_view_host_set.insert(render_view_host); | 5482 render_view_host_set.insert(render_view_host); |
| 5476 } | 5483 } |
| 5477 for (RenderViewHost* render_view_host : render_view_host_set) | 5484 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5478 render_view_host->OnWebkitPreferencesChanged(); | 5485 render_view_host->OnWebkitPreferencesChanged(); |
| 5479 } | 5486 } |
| 5480 | 5487 |
| 5481 } // namespace content | 5488 } // namespace content |
| OLD | NEW |