Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2472253002: Fix navigation requests starting too early and not getting associated with the <webview>. (Closed)
Patch Set: nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 // https://crbug.com/545684 1551 // https://crbug.com/545684
1552 int32_t view_routing_id = params.routing_id; 1552 int32_t view_routing_id = params.routing_id;
1553 int32_t main_frame_widget_routing_id = params.main_frame_widget_routing_id; 1553 int32_t main_frame_widget_routing_id = params.main_frame_widget_routing_id;
1554 if (main_frame_widget_routing_id == MSG_ROUTING_NONE) { 1554 if (main_frame_widget_routing_id == MSG_ROUTING_NONE) {
1555 view_routing_id = main_frame_widget_routing_id = 1555 view_routing_id = main_frame_widget_routing_id =
1556 site_instance->GetProcess()->GetNextRoutingID(); 1556 site_instance->GetProcess()->GetNextRoutingID();
1557 } 1557 }
1558 1558
1559 GetRenderManager()->Init(site_instance.get(), view_routing_id, 1559 GetRenderManager()->Init(site_instance.get(), view_routing_id,
1560 params.main_frame_routing_id, 1560 params.main_frame_routing_id,
1561 main_frame_widget_routing_id); 1561 main_frame_widget_routing_id,
1562 params.renderer_initiated_creation);
1562 1563
1563 // blink::FrameTree::setName always keeps |unique_name| empty in case of a 1564 // blink::FrameTree::setName always keeps |unique_name| empty in case of a
1564 // main frame - let's do the same thing here. 1565 // main frame - let's do the same thing here.
1565 std::string unique_name; 1566 std::string unique_name;
1566 frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); 1567 frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
1567 1568
1568 WebContentsViewDelegate* delegate = 1569 WebContentsViewDelegate* delegate =
1569 GetContentClient()->browser()->GetWebContentsViewDelegate(this); 1570 GetContentClient()->browser()->GetWebContentsViewDelegate(this);
1570 1571
1571 #if defined(USE_AURA) 1572 #if defined(USE_AURA)
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 !delegate_->ShouldCreateWebContents( 2053 !delegate_->ShouldCreateWebContents(
2053 this, route_id, main_frame_route_id, main_frame_widget_route_id, 2054 this, route_id, main_frame_route_id, main_frame_widget_route_id,
2054 params.window_container_type, params.frame_name, params.target_url, 2055 params.window_container_type, params.frame_name, params.target_url,
2055 partition_id, session_storage_namespace)) { 2056 partition_id, session_storage_namespace)) {
2056 if (route_id != MSG_ROUTING_NONE && 2057 if (route_id != MSG_ROUTING_NONE &&
2057 !RenderViewHost::FromID(render_process_id, route_id)) { 2058 !RenderViewHost::FromID(render_process_id, route_id)) {
2058 // If the embedder didn't create a WebContents for this route, we need to 2059 // If the embedder didn't create a WebContents for this route, we need to
2059 // delete the RenderView that had already been created. 2060 // delete the RenderView that had already been created.
2060 Send(new ViewMsg_Close(route_id)); 2061 Send(new ViewMsg_Close(route_id));
2061 } 2062 }
2063 // Note: even though we're not creating a WebContents here, it could have
2064 // been created by the embedder so ensure that the RenderFrameHost is
2065 // properly initialized.
2062 // It's safe to only target the frame because the render process will not 2066 // It's safe to only target the frame because the render process will not
2063 // have a chance to create more frames at this point. 2067 // have a chance to create more frames at this point.
2064 ResourceDispatcherHostImpl::ResumeBlockedRequestsForRouteFromUI( 2068 RenderFrameHostImpl* rfh =
2065 GlobalFrameRoutingId(render_process_id, main_frame_route_id)); 2069 RenderFrameHostImpl::FromID(render_process_id, main_frame_route_id);
2070 if (rfh)
2071 rfh->Init();
2066 return; 2072 return;
2067 } 2073 }
2068 2074
2069 // Create the new web contents. This will automatically create the new 2075 // Create the new web contents. This will automatically create the new
2070 // WebContentsView. In the future, we may want to create the view separately. 2076 // WebContentsView. In the future, we may want to create the view separately.
2071 CreateParams create_params(GetBrowserContext(), site_instance.get()); 2077 CreateParams create_params(GetBrowserContext(), site_instance.get());
2072 create_params.routing_id = route_id; 2078 create_params.routing_id = route_id;
2073 create_params.main_frame_routing_id = main_frame_route_id; 2079 create_params.main_frame_routing_id = main_frame_route_id;
2074 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; 2080 create_params.main_frame_widget_routing_id = main_frame_widget_route_id;
2075 create_params.main_frame_name = params.frame_name; 2081 create_params.main_frame_name = params.frame_name;
(...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after
5185 dialog_manager_ = dialog_manager; 5191 dialog_manager_ = dialog_manager;
5186 } 5192 }
5187 5193
5188 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { 5194 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) {
5189 auto it = binding_sets_.find(interface_name); 5195 auto it = binding_sets_.find(interface_name);
5190 if (it != binding_sets_.end()) 5196 if (it != binding_sets_.end())
5191 binding_sets_.erase(it); 5197 binding_sets_.erase(it);
5192 } 5198 }
5193 5199
5194 } // namespace content 5200 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/test/test_render_frame_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698