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/renderer_host/render_widget_helper.h" | 5 #include "content/browser/renderer_host/render_widget_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 | 97 |
98 void RenderWidgetHelper::OnResumeDeferredNavigation( | 98 void RenderWidgetHelper::OnResumeDeferredNavigation( |
99 const GlobalRequestID& request_id) { | 99 const GlobalRequestID& request_id) { |
100 resource_dispatcher_host_->ResumeDeferredNavigation(request_id); | 100 resource_dispatcher_host_->ResumeDeferredNavigation(request_id); |
101 } | 101 } |
102 | 102 |
103 void RenderWidgetHelper::CreateNewWindow( | 103 void RenderWidgetHelper::CreateNewWindow( |
104 const ViewHostMsg_CreateWindow_Params& params, | 104 const ViewHostMsg_CreateWindow_Params& params, |
105 bool no_javascript_access, | 105 bool no_javascript_access, |
106 base::ProcessHandle render_process, | 106 base::ProcessHandle render_process, |
107 int* route_id, | 107 int32* route_id, |
108 int* main_frame_route_id, | 108 int32* main_frame_route_id, |
109 int* surface_id, | 109 int32* main_frame_widget_route_id, |
110 int32* surface_id, | |
110 SessionStorageNamespace* session_storage_namespace) { | 111 SessionStorageNamespace* session_storage_namespace) { |
111 if (params.opener_suppressed || no_javascript_access) { | 112 if (params.opener_suppressed || no_javascript_access) { |
112 // If the opener is supppressed or script access is disallowed, we should | 113 // If the opener is supppressed or script access is disallowed, we should |
113 // open the window in a new BrowsingInstance, and thus a new process. That | 114 // open the window in a new BrowsingInstance, and thus a new process. That |
114 // means the current renderer process will not be able to route messages to | 115 // means the current renderer process will not be able to route messages to |
115 // it. Because of this, we will immediately show and navigate the window | 116 // it. Because of this, we will immediately show and navigate the window |
116 // in OnCreateWindowOnUI, using the params provided here. | 117 // in OnCreateWindowOnUI, using the params provided here. |
117 *route_id = MSG_ROUTING_NONE; | 118 *route_id = MSG_ROUTING_NONE; |
118 *main_frame_route_id = MSG_ROUTING_NONE; | 119 *main_frame_route_id = MSG_ROUTING_NONE; |
120 *main_frame_widget_route_id = MSG_ROUTING_NONE; | |
119 *surface_id = 0; | 121 *surface_id = 0; |
120 } else { | 122 } else { |
121 *route_id = GetNextRoutingID(); | 123 *route_id = GetNextRoutingID(); |
122 *main_frame_route_id = GetNextRoutingID(); | 124 *main_frame_route_id = GetNextRoutingID(); |
125 *main_frame_widget_route_id = GetNextRoutingID(); | |
123 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 126 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
124 render_process_id_, *route_id); | 127 render_process_id_, *route_id); |
125 // Block resource requests until the view is created, since the HWND might | 128 // Block resource requests until the view is created, since the HWND might |
126 // be needed if a response ends up creating a plugin. | 129 // be needed if a response ends up creating a plugin. |
127 resource_dispatcher_host_->BlockRequestsForRoute( | 130 resource_dispatcher_host_->BlockRequestsForRoute( |
128 render_process_id_, *route_id); | 131 render_process_id_, *route_id); |
129 resource_dispatcher_host_->BlockRequestsForRoute( | 132 resource_dispatcher_host_->BlockRequestsForRoute( |
130 render_process_id_, *main_frame_route_id); | 133 render_process_id_, *main_frame_route_id); |
ncarter (slow)
2015/08/24 20:55:35
Is this relevant for the third route as well?
dcheng
2015/09/03 16:33:09
Done.
| |
131 } | 134 } |
132 | 135 |
133 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
134 BrowserThread::UI, FROM_HERE, | 137 BrowserThread::UI, FROM_HERE, |
135 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, | 138 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, |
136 this, params, *route_id, *main_frame_route_id, | 139 this, params, *route_id, *main_frame_route_id, |
ncarter (slow)
2015/08/24 20:55:35
If the main_frame_widget_route_id isn't passed to
dcheng
2015/09/03 16:33:09
This was part of the incomplete browser-side plumb
| |
137 make_scoped_refptr(session_storage_namespace))); | 140 make_scoped_refptr(session_storage_namespace))); |
138 } | 141 } |
139 | 142 |
140 void RenderWidgetHelper::OnCreateWindowOnUI( | 143 void RenderWidgetHelper::OnCreateWindowOnUI( |
141 const ViewHostMsg_CreateWindow_Params& params, | 144 const ViewHostMsg_CreateWindow_Params& params, |
142 int route_id, | 145 int route_id, |
143 int main_frame_route_id, | 146 int main_frame_route_id, |
144 SessionStorageNamespace* session_storage_namespace) { | 147 SessionStorageNamespace* session_storage_namespace) { |
145 RenderViewHostImpl* host = | 148 RenderViewHostImpl* host = |
146 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); | 149 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 | 194 |
192 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, | 195 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int opener_id, |
193 int route_id) { | 196 int route_id) { |
194 RenderViewHostImpl* host = RenderViewHostImpl::FromID( | 197 RenderViewHostImpl* host = RenderViewHostImpl::FromID( |
195 render_process_id_, opener_id); | 198 render_process_id_, opener_id); |
196 if (host) | 199 if (host) |
197 host->CreateNewFullscreenWidget(route_id); | 200 host->CreateNewFullscreenWidget(route_id); |
198 } | 201 } |
199 | 202 |
200 } // namespace content | 203 } // namespace content |
OLD | NEW |