OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 old_render_frame_host->render_view_host()->GetWidget()->GetView()) { | 2208 old_render_frame_host->render_view_host()->GetWidget()->GetView()) { |
2209 old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide(); | 2209 old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide(); |
2210 } | 2210 } |
2211 | 2211 |
2212 // Make sure the size is up to date. (Fix for bug 1079768.) | 2212 // Make sure the size is up to date. (Fix for bug 1079768.) |
2213 delegate_->UpdateRenderViewSizeForRenderManager(); | 2213 delegate_->UpdateRenderViewSizeForRenderManager(); |
2214 | 2214 |
2215 if (will_focus_location_bar) { | 2215 if (will_focus_location_bar) { |
2216 delegate_->SetFocusToLocationBar(false); | 2216 delegate_->SetFocusToLocationBar(false); |
2217 } else if (focus_render_view && render_frame_host_->GetView()) { | 2217 } else if (focus_render_view && render_frame_host_->GetView()) { |
2218 render_frame_host_->GetView()->Focus(); | 2218 if (is_main_frame) { |
| 2219 render_frame_host_->GetView()->Focus(); |
| 2220 } else { |
| 2221 // The main frame's view is already focused, but we need to set |
| 2222 // page-level focus in the subframe's renderer. |
| 2223 frame_tree_node_->frame_tree()->SetPageFocus( |
| 2224 render_frame_host_->GetSiteInstance(), true); |
| 2225 } |
2219 } | 2226 } |
2220 | 2227 |
2221 // Notify that we've swapped RenderFrameHosts. We do this before shutting down | 2228 // Notify that we've swapped RenderFrameHosts. We do this before shutting down |
2222 // the RFH so that we can clean up RendererResources related to the RFH first. | 2229 // the RFH so that we can clean up RendererResources related to the RFH first. |
2223 delegate_->NotifySwappedFromRenderManager( | 2230 delegate_->NotifySwappedFromRenderManager( |
2224 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); | 2231 old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); |
2225 | 2232 |
2226 // The RenderViewHost keeps track of the main RenderFrameHost routing id. | 2233 // The RenderViewHost keeps track of the main RenderFrameHost routing id. |
2227 // If this is committing a main frame navigation, update it and set the | 2234 // If this is committing a main frame navigation, update it and set the |
2228 // routing id in the RenderViewHost associated with the old RenderFrameHost | 2235 // routing id in the RenderViewHost associated with the old RenderFrameHost |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2655 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2649 if (!frame_tree_node_->opener()) | 2656 if (!frame_tree_node_->opener()) |
2650 return MSG_ROUTING_NONE; | 2657 return MSG_ROUTING_NONE; |
2651 | 2658 |
2652 return frame_tree_node_->opener() | 2659 return frame_tree_node_->opener() |
2653 ->render_manager() | 2660 ->render_manager() |
2654 ->GetRoutingIdForSiteInstance(instance); | 2661 ->GetRoutingIdForSiteInstance(instance); |
2655 } | 2662 } |
2656 | 2663 |
2657 } // namespace content | 2664 } // namespace content |
OLD | NEW |