Chromium Code Reviews| 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 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 // Render{View,Frame}Host must be initialized and the RenderWidgetHostView | 1444 // Render{View,Frame}Host must be initialized and the RenderWidgetHostView |
| 1445 // created. This is needed because the usual initialization happens during | 1445 // created. This is needed because the usual initialization happens during |
| 1446 // the first navigation, but when attaching a new window we don't navigate | 1446 // the first navigation, but when attaching a new window we don't navigate |
| 1447 // before attaching. If the browser side is already initialized, the calls | 1447 // before attaching. If the browser side is already initialized, the calls |
| 1448 // below will just early return. | 1448 // below will just early return. |
| 1449 render_manager->InitRenderView(GetRenderViewHost(), nullptr); | 1449 render_manager->InitRenderView(GetRenderViewHost(), nullptr); |
| 1450 GetMainFrame()->Init(); | 1450 GetMainFrame()->Init(); |
| 1451 if (!render_manager->GetRenderWidgetHostView()) | 1451 if (!render_manager->GetRenderWidgetHostView()) |
| 1452 CreateRenderWidgetHostViewForRenderManager(GetRenderViewHost()); | 1452 CreateRenderWidgetHostViewForRenderManager(GetRenderViewHost()); |
| 1453 | 1453 |
| 1454 auto* outer_web_contents_impl = | |
| 1455 static_cast<WebContentsImpl*>(outer_web_contents); | |
| 1456 auto* outer_contents_frame_impl = | |
| 1457 static_cast<RenderFrameHostImpl*>(outer_contents_frame); | |
| 1454 // Create a link to our outer WebContents. | 1458 // Create a link to our outer WebContents. |
| 1455 node_.reset(new WebContentsTreeNode()); | 1459 node_.reset(new WebContentsTreeNode()); |
| 1456 node_->ConnectToOuterWebContents( | 1460 node_->ConnectToOuterWebContents(this, outer_web_contents_impl, |
| 1457 this, static_cast<WebContentsImpl*>(outer_web_contents), | 1461 outer_contents_frame_impl); |
| 1458 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); | |
| 1459 | 1462 |
| 1460 DCHECK(outer_contents_frame); | 1463 DCHECK(outer_contents_frame); |
| 1461 | 1464 |
| 1462 // Create a proxy in top-level RenderFrameHostManager, pointing to the | 1465 // Create a proxy in top-level RenderFrameHostManager, pointing to the |
| 1463 // SiteInstance of the outer WebContents. The proxy will be used to send | 1466 // SiteInstance of the outer WebContents. The proxy will be used to send |
| 1464 // postMessage to the inner WebContents. | 1467 // postMessage to the inner WebContents. |
| 1465 render_manager->CreateOuterDelegateProxy( | 1468 render_manager->CreateOuterDelegateProxy( |
| 1466 outer_contents_frame->GetSiteInstance(), | 1469 outer_contents_frame->GetSiteInstance(), outer_contents_frame_impl); |
| 1467 static_cast<RenderFrameHostImpl*>(outer_contents_frame)); | |
| 1468 | 1470 |
| 1469 render_manager->SetRWHViewForInnerContents( | 1471 render_manager->SetRWHViewForInnerContents( |
| 1470 render_manager->GetRenderWidgetHostView()); | 1472 render_manager->GetRenderWidgetHostView()); |
| 1471 | 1473 |
| 1472 static_cast<RenderWidgetHostViewChildFrame*>( | 1474 static_cast<RenderWidgetHostViewChildFrame*>( |
| 1473 render_manager->GetRenderWidgetHostView()) | 1475 render_manager->GetRenderWidgetHostView()) |
| 1474 ->RegisterFrameSinkId(); | 1476 ->RegisterFrameSinkId(); |
| 1475 | 1477 |
| 1478 if (outer_web_contents_impl->frame_tree_.GetFocusedFrame() == | |
| 1479 outer_contents_frame_impl->frame_tree_node()) { | |
| 1480 SetFocusedFrame(frame_tree_.root(), nullptr); | |
|
alexmos
2017/03/04 01:12:16
I'm curious if this makes the code that returns th
avallee
2017/03/15 02:55:20
This will end up calling focus on the widget which
| |
| 1481 } | |
| 1482 | |
| 1476 // Set up the the guest's AX tree to point back at the embedder's AX tree. | 1483 // Set up the the guest's AX tree to point back at the embedder's AX tree. |
| 1477 auto* parent_frame = outer_contents_frame->GetParent(); | 1484 auto* parent_frame = outer_contents_frame->GetParent(); |
| 1478 GetMainFrame()->set_browser_plugin_embedder_ax_tree_id( | 1485 GetMainFrame()->set_browser_plugin_embedder_ax_tree_id( |
| 1479 parent_frame->GetAXTreeID()); | 1486 parent_frame->GetAXTreeID()); |
| 1480 GetMainFrame()->UpdateAXTreeData(); | 1487 GetMainFrame()->UpdateAXTreeData(); |
| 1481 | 1488 |
| 1482 // At this point, we should destroy the TextInputManager which will notify all | 1489 // At this point, we should destroy the TextInputManager which will notify all |
| 1483 // the RWHV in this WebContents. The RWHV in this WebContents should use the | 1490 // the RWHV in this WebContents. The RWHV in this WebContents should use the |
| 1484 // TextInputManager owned by the outer WebContents. | 1491 // TextInputManager owned by the outer WebContents. |
| 1485 // TODO(ekaramad): Is it possible to have TextInputState before attaching to | 1492 // TODO(ekaramad): Is it possible to have TextInputState before attaching to |
| (...skipping 4009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5495 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5502 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5496 if (!render_view_host) | 5503 if (!render_view_host) |
| 5497 continue; | 5504 continue; |
| 5498 render_view_host_set.insert(render_view_host); | 5505 render_view_host_set.insert(render_view_host); |
| 5499 } | 5506 } |
| 5500 for (RenderViewHost* render_view_host : render_view_host_set) | 5507 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5501 render_view_host->OnWebkitPreferencesChanged(); | 5508 render_view_host->OnWebkitPreferencesChanged(); |
| 5502 } | 5509 } |
| 5503 | 5510 |
| 5504 } // namespace content | 5511 } // namespace content |
| OLD | NEW |