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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void RenderWidgetHelper::ResumeDeferredNavigation( | 76 void RenderWidgetHelper::ResumeDeferredNavigation( |
77 const GlobalRequestID& request_id) { | 77 const GlobalRequestID& request_id) { |
78 BrowserThread::PostTask( | 78 BrowserThread::PostTask( |
79 BrowserThread::IO, FROM_HERE, | 79 BrowserThread::IO, FROM_HERE, |
80 base::Bind(&RenderWidgetHelper::OnResumeDeferredNavigation, | 80 base::Bind(&RenderWidgetHelper::OnResumeDeferredNavigation, |
81 this, | 81 this, |
82 request_id)); | 82 request_id)); |
83 } | 83 } |
84 | 84 |
85 void RenderWidgetHelper::ResumeRequestsForView(int route_id) { | 85 void RenderWidgetHelper::ResumeRequestsForFrame(int route_id) { |
86 // We only need to resume blocked requests if we used a valid route_id. | 86 // We only need to resume blocked requests if we used a valid route_id. |
87 // See CreateNewWindow. | 87 // See CreateNewWindow. |
88 if (route_id != MSG_ROUTING_NONE) { | 88 if (route_id != MSG_ROUTING_NONE) { |
89 BrowserThread::PostTask( | 89 BrowserThread::PostTask( |
90 BrowserThread::IO, FROM_HERE, | 90 BrowserThread::IO, FROM_HERE, |
91 base::Bind(&RenderWidgetHelper::OnResumeRequestsForView, | 91 base::Bind(&RenderWidgetHelper::OnResumeRequestsForFrame, this, |
92 this, route_id)); | 92 route_id)); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 void RenderWidgetHelper::OnResumeDeferredNavigation( | 96 void RenderWidgetHelper::OnResumeDeferredNavigation( |
97 const GlobalRequestID& request_id) { | 97 const GlobalRequestID& request_id) { |
98 resource_dispatcher_host_->ResumeDeferredNavigation(request_id); | 98 resource_dispatcher_host_->ResumeDeferredNavigation(request_id); |
99 } | 99 } |
100 | 100 |
101 void RenderWidgetHelper::CreateNewWindow( | 101 void RenderWidgetHelper::CreateNewWindow( |
102 const ViewHostMsg_CreateWindow_Params& params, | 102 const ViewHostMsg_CreateWindow_Params& params, |
(...skipping 12 matching lines...) Expand all Loading... |
115 *route_id = MSG_ROUTING_NONE; | 115 *route_id = MSG_ROUTING_NONE; |
116 *main_frame_route_id = MSG_ROUTING_NONE; | 116 *main_frame_route_id = MSG_ROUTING_NONE; |
117 *main_frame_widget_route_id = MSG_ROUTING_NONE; | 117 *main_frame_widget_route_id = MSG_ROUTING_NONE; |
118 } else { | 118 } else { |
119 *route_id = GetNextRoutingID(); | 119 *route_id = GetNextRoutingID(); |
120 *main_frame_route_id = GetNextRoutingID(); | 120 *main_frame_route_id = GetNextRoutingID(); |
121 // TODO(avi): When RenderViewHostImpl has-a RenderWidgetHostImpl, this | 121 // TODO(avi): When RenderViewHostImpl has-a RenderWidgetHostImpl, this |
122 // should be updated to give the widget a distinct routing ID. | 122 // should be updated to give the widget a distinct routing ID. |
123 // https://crbug.com/545684 | 123 // https://crbug.com/545684 |
124 *main_frame_widget_route_id = *route_id; | 124 *main_frame_widget_route_id = *route_id; |
125 // Block resource requests until the view is created, since the HWND might | 125 // Block resource requests until the frame is created, since the HWND might |
126 // be needed if a response ends up creating a plugin. | 126 // be needed if a response ends up creating a plugin. |
127 resource_dispatcher_host_->BlockRequestsForRoute( | 127 resource_dispatcher_host_->BlockRequestsForFrame(render_process_id_, |
128 render_process_id_, *route_id); | 128 *main_frame_route_id); |
129 } | 129 } |
130 | 130 |
131 BrowserThread::PostTask( | 131 BrowserThread::PostTask( |
132 BrowserThread::UI, FROM_HERE, | 132 BrowserThread::UI, FROM_HERE, |
133 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, this, params, | 133 base::Bind(&RenderWidgetHelper::OnCreateWindowOnUI, this, params, |
134 *route_id, *main_frame_route_id, *main_frame_widget_route_id, | 134 *route_id, *main_frame_route_id, *main_frame_widget_route_id, |
135 make_scoped_refptr(session_storage_namespace))); | 135 make_scoped_refptr(session_storage_namespace))); |
136 } | 136 } |
137 | 137 |
138 void RenderWidgetHelper::OnCreateWindowOnUI( | 138 void RenderWidgetHelper::OnCreateWindowOnUI( |
139 const ViewHostMsg_CreateWindow_Params& params, | 139 const ViewHostMsg_CreateWindow_Params& params, |
140 int32_t route_id, | 140 int32_t route_id, |
141 int32_t main_frame_route_id, | 141 int32_t main_frame_route_id, |
142 int32_t main_frame_widget_route_id, | 142 int32_t main_frame_widget_route_id, |
143 SessionStorageNamespace* session_storage_namespace) { | 143 SessionStorageNamespace* session_storage_namespace) { |
144 RenderViewHostImpl* host = | 144 RenderViewHostImpl* host = |
145 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); | 145 RenderViewHostImpl::FromID(render_process_id_, params.opener_id); |
146 if (host) | 146 if (host) |
147 host->CreateNewWindow(route_id, main_frame_route_id, | 147 host->CreateNewWindow(route_id, main_frame_route_id, |
148 main_frame_widget_route_id, params, | 148 main_frame_widget_route_id, params, |
149 session_storage_namespace); | 149 session_storage_namespace); |
150 } | 150 } |
151 | 151 |
152 void RenderWidgetHelper::OnResumeRequestsForView(int route_id) { | 152 void RenderWidgetHelper::OnResumeRequestsForFrame(int route_id) { |
153 resource_dispatcher_host_->ResumeBlockedRequestsForRoute( | 153 resource_dispatcher_host_->ResumeBlockedRequestsForFrame(render_process_id_, |
154 render_process_id_, route_id); | 154 route_id); |
155 } | 155 } |
156 | 156 |
157 void RenderWidgetHelper::CreateNewWidget(int opener_id, | 157 void RenderWidgetHelper::CreateNewWidget(int opener_id, |
158 blink::WebPopupType popup_type, | 158 blink::WebPopupType popup_type, |
159 int* route_id) { | 159 int* route_id) { |
160 *route_id = GetNextRoutingID(); | 160 *route_id = GetNextRoutingID(); |
161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
162 base::Bind(&RenderWidgetHelper::OnCreateWidgetOnUI, | 162 base::Bind(&RenderWidgetHelper::OnCreateWidgetOnUI, |
163 this, opener_id, *route_id, popup_type)); | 163 this, opener_id, *route_id, popup_type)); |
164 } | 164 } |
(...skipping 18 matching lines...) Expand all Loading... |
183 | 183 |
184 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int32 opener_id, | 184 void RenderWidgetHelper::OnCreateFullscreenWidgetOnUI(int32 opener_id, |
185 int32 route_id) { | 185 int32 route_id) { |
186 RenderViewHostImpl* host = RenderViewHostImpl::FromID( | 186 RenderViewHostImpl* host = RenderViewHostImpl::FromID( |
187 render_process_id_, opener_id); | 187 render_process_id_, opener_id); |
188 if (host) | 188 if (host) |
189 host->CreateNewFullscreenWidget(route_id); | 189 host->CreateNewFullscreenWidget(route_id); |
190 } | 190 } |
191 | 191 |
192 } // namespace content | 192 } // namespace content |
OLD | NEW |