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

Side by Side Diff: content/browser/renderer_host/render_widget_helper.cc

Issue 1303773002: Give the main frame a RenderWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: plumb through surface ID *and* widget surface ID for window.open Created 5 years, 3 months 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/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
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* surface_id,
109 int* surface_id, 109 int32* main_frame_route_id,
110 int32* main_frame_widget_route_id,
111 int32* widget_surface_id,
110 SessionStorageNamespace* session_storage_namespace) { 112 SessionStorageNamespace* session_storage_namespace) {
111 if (params.opener_suppressed || no_javascript_access) { 113 if (params.opener_suppressed || no_javascript_access) {
112 // If the opener is supppressed or script access is disallowed, we should 114 // 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 115 // 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 116 // 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 117 // it. Because of this, we will immediately show and navigate the window
116 // in OnCreateWindowOnUI, using the params provided here. 118 // in OnCreateWindowOnUI, using the params provided here.
117 *route_id = MSG_ROUTING_NONE; 119 *route_id = MSG_ROUTING_NONE;
120 *surface_id = 0;
118 *main_frame_route_id = MSG_ROUTING_NONE; 121 *main_frame_route_id = MSG_ROUTING_NONE;
119 *surface_id = 0; 122 *main_frame_widget_route_id = MSG_ROUTING_NONE;
123 *widget_surface_id = 0;
120 } else { 124 } else {
121 *route_id = GetNextRoutingID(); 125 *route_id = GetNextRoutingID();
122 *main_frame_route_id = GetNextRoutingID(); 126 // TODO(dcheng): Use the main frame RenderWidgetHost for painting instead of
127 // the RenderViewHost. https://crbug.com/526958
123 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( 128 *surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
124 render_process_id_, *route_id); 129 render_process_id_, *route_id);
130 *main_frame_route_id = GetNextRoutingID();
131 *main_frame_widget_route_id = GetNextRoutingID();
132 *widget_surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer(
133 render_process_id_, *main_frame_widget_route_id);
125 // Block resource requests until the view is created, since the HWND might 134 // Block resource requests until the view is created, since the HWND might
126 // be needed if a response ends up creating a plugin. 135 // be needed if a response ends up creating a plugin.
127 resource_dispatcher_host_->BlockRequestsForRoute( 136 resource_dispatcher_host_->BlockRequestsForRoute(
128 render_process_id_, *route_id); 137 render_process_id_, *route_id);
129 resource_dispatcher_host_->BlockRequestsForRoute( 138 resource_dispatcher_host_->BlockRequestsForRoute(
130 render_process_id_, *main_frame_route_id); 139 render_process_id_, *main_frame_route_id);
140 resource_dispatcher_host_->BlockRequestsForRoute(
141 render_process_id_, *main_frame_widget_route_id);
131 } 142 }
132 143
133 BrowserThread::PostTask( 144 BrowserThread::PostTask(
134 BrowserThread::UI, FROM_HERE, 145 BrowserThread::UI, FROM_HERE,
135 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, 146 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, this, params,
136 this, params, *route_id, *main_frame_route_id, 147 *route_id, *main_frame_route_id, *main_frame_widget_route_id,
148 *widget_surface_id,
137 make_scoped_refptr(session_storage_namespace))); 149 make_scoped_refptr(session_storage_namespace)));
138 } 150 }
139 151
140 void RenderWidgetHelper::OnCreateWindowOnUI( 152 void RenderWidgetHelper::OnCreateWindowOnUI(
141 const ViewHostMsg_CreateWindow_Params& params, 153 const ViewHostMsg_CreateWindow_Params& params,
142 int route_id, 154 int32 route_id,
143 int main_frame_route_id, 155 int32 main_frame_route_id,
156 int32 main_frame_widget_route_id,
157 int32 surface_id,
144 SessionStorageNamespace* session_storage_namespace) { 158 SessionStorageNamespace* session_storage_namespace) {
145 RenderViewHostImpl* host = 159 RenderViewHostImpl* host =
146 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); 160 RenderViewHostImpl::FromID(render_process_id_, params.opener_id);
147 if (host) 161 if (host)
148 host->CreateNewWindow(route_id, main_frame_route_id, params, 162 host->CreateNewWindow(route_id, main_frame_route_id,
149 session_storage_namespace); 163 main_frame_widget_route_id, surface_id, params,
164 session_storage_namespace);
150 } 165 }
151 166
152 void RenderWidgetHelper::OnResumeRequestsForView(int route_id) { 167 void RenderWidgetHelper::OnResumeRequestsForView(int route_id) {
153 resource_dispatcher_host_->ResumeBlockedRequestsForRoute( 168 resource_dispatcher_host_->ResumeBlockedRequestsForRoute(
154 render_process_id_, route_id); 169 render_process_id_, route_id);
155 } 170 }
156 171
157 void RenderWidgetHelper::CreateNewWidget(int opener_id, 172 void RenderWidgetHelper::CreateNewWidget(int opener_id,
158 blink::WebPopupType popup_type, 173 blink::WebPopupType popup_type,
159 int* route_id, 174 int* route_id,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int32 opener_id, 207 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int32 opener_id,
193 int32 route_id, 208 int32 route_id,
194 int32 surface_id) { 209 int32 surface_id) {
195 RenderViewHostImpl* host = RenderViewHostImpl::FromID( 210 RenderViewHostImpl* host = RenderViewHostImpl::FromID(
196 render_process_id_, opener_id); 211 render_process_id_, opener_id);
197 if (host) 212 if (host)
198 host->CreateNewFullscreenWidget(route_id, surface_id); 213 host->CreateNewFullscreenWidget(route_id, surface_id);
199 } 214 }
200 215
201 } // namespace content 216 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698