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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2213653002: Revert of Add WebWidgetTestProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return content::RenderWidgetMusConnection::GetOrCreate( 206 return content::RenderWidgetMusConnection::GetOrCreate(
207 widget->routing_id()); 207 widget->routing_id());
208 } 208 }
209 #endif 209 #endif
210 // If we don't have a connection to the Mojo shell, then we want to route IPCs 210 // If we don't have a connection to the Mojo shell, then we want to route IPCs
211 // back to the browser process rather than Mus so we use the |widget| as the 211 // back to the browser process rather than Mus so we use the |widget| as the
212 // RenderWidgetInputHandlerDelegate. 212 // RenderWidgetInputHandlerDelegate.
213 return widget; 213 return widget;
214 } 214 }
215 215
216 content::RenderWidget::CreateRenderWidgetFunction g_create_render_widget =
217 nullptr;
218
219 } // namespace 216 } // namespace
220 217
221 namespace content { 218 namespace content {
222 219
223 // RenderWidget --------------------------------------------------------------- 220 // RenderWidget ---------------------------------------------------------------
224 221
225 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps, 222 RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
226 blink::WebPopupType popup_type, 223 blink::WebPopupType popup_type,
227 const blink::WebScreenInfo& screen_info, 224 const blink::WebScreenInfo& screen_info,
228 bool swapped_out, 225 bool swapped_out,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 281
285 RenderWidget::~RenderWidget() { 282 RenderWidget::~RenderWidget() {
286 DCHECK(!webwidget_) << "Leaking our WebWidget!"; 283 DCHECK(!webwidget_) << "Leaking our WebWidget!";
287 284
288 // If we are swapped out, we have released already. 285 // If we are swapped out, we have released already.
289 if (!is_swapped_out_ && RenderProcess::current()) 286 if (!is_swapped_out_ && RenderProcess::current())
290 RenderProcess::current()->ReleaseProcess(); 287 RenderProcess::current()->ReleaseProcess();
291 } 288 }
292 289
293 // static 290 // static
294 void RenderWidget::InstallCreateHook(
295 CreateRenderWidgetFunction create_render_widget) {
296 CHECK(!g_create_render_widget);
297 g_create_render_widget = create_render_widget;
298 }
299
300 // static
301 RenderWidget* RenderWidget::Create(int32_t opener_id, 291 RenderWidget* RenderWidget::Create(int32_t opener_id,
302 CompositorDependencies* compositor_deps, 292 CompositorDependencies* compositor_deps,
303 blink::WebPopupType popup_type, 293 blink::WebPopupType popup_type,
304 const blink::WebScreenInfo& screen_info) { 294 const blink::WebScreenInfo& screen_info) {
305 DCHECK(opener_id != MSG_ROUTING_NONE); 295 DCHECK(opener_id != MSG_ROUTING_NONE);
306 scoped_refptr<RenderWidget> widget(new RenderWidget( 296 scoped_refptr<RenderWidget> widget(new RenderWidget(
307 compositor_deps, popup_type, screen_info, false, false, false)); 297 compositor_deps, popup_type, screen_info, false, false, false));
308 if (widget->Init(opener_id)) { // adds reference on success. 298 if (widget->Init(opener_id)) { // adds reference on success.
309 return widget.get(); 299 return widget.get();
310 } 300 }
(...skipping 11 matching lines...) Expand all
322 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the 312 // TODO(avi): Before RenderViewImpl has-a RenderWidget, the browser passes the
323 // same routing ID for both the view routing ID and the main frame widget 313 // same routing ID for both the view routing ID and the main frame widget
324 // routing ID. https://crbug.com/545684 314 // routing ID. https://crbug.com/545684
325 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id); 315 RenderViewImpl* view = RenderViewImpl::FromRoutingID(routing_id);
326 if (view) { 316 if (view) {
327 view->AttachWebFrameWidget( 317 view->AttachWebFrameWidget(
328 RenderWidget::CreateWebFrameWidget(view->GetWidget(), frame)); 318 RenderWidget::CreateWebFrameWidget(view->GetWidget(), frame));
329 return view->GetWidget(); 319 return view->GetWidget();
330 } 320 }
331 scoped_refptr<RenderWidget> widget( 321 scoped_refptr<RenderWidget> widget(
332 g_create_render_widget 322 new RenderWidget(compositor_deps, blink::WebPopupTypeNone, screen_info,
333 ? g_create_render_widget(compositor_deps, blink::WebPopupTypeNone, 323 false, hidden, false));
334 screen_info, false, hidden, false)
335 : new RenderWidget(compositor_deps, blink::WebPopupTypeNone,
336 screen_info, false, hidden, false));
337 widget->SetRoutingID(routing_id); 324 widget->SetRoutingID(routing_id);
338 widget->for_oopif_ = true; 325 widget->for_oopif_ = true;
339 // DoInit increments the reference count on |widget|, keeping it alive after 326 // DoInit increments the reference count on |widget|, keeping it alive after
340 // this function returns. 327 // this function returns.
341 if (widget->DoInit(MSG_ROUTING_NONE, 328 if (widget->DoInit(MSG_ROUTING_NONE,
342 RenderWidget::CreateWebFrameWidget(widget.get(), frame), 329 RenderWidget::CreateWebFrameWidget(widget.get(), frame),
343 nullptr)) { 330 nullptr)) {
344 return widget.get(); 331 return widget.get();
345 } 332 }
346 return nullptr; 333 return nullptr;
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 void RenderWidget::requestPointerUnlock() { 2066 void RenderWidget::requestPointerUnlock() {
2080 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); 2067 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get());
2081 } 2068 }
2082 2069
2083 bool RenderWidget::isPointerLocked() { 2070 bool RenderWidget::isPointerLocked() {
2084 return mouse_lock_dispatcher_->IsMouseLockedTo( 2071 return mouse_lock_dispatcher_->IsMouseLockedTo(
2085 webwidget_mouse_lock_target_.get()); 2072 webwidget_mouse_lock_target_.get());
2086 } 2073 }
2087 2074
2088 } // namespace content 2075 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/shell/renderer/layout_test/layout_test_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698