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

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

Issue 2498463002: RenderWidget/RenderView: encapsulate ViewHostMsg_Show, etc, in a callback (Closed)
Patch Set: Remove RenderWidgetFullscreen Created 4 years 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_fullscreen_pepper.h" 5 #include "content/renderer/render_widget_fullscreen_pepper.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 WebSize size_; 246 WebSize size_;
247 247
248 DISALLOW_COPY_AND_ASSIGN(PepperWidget); 248 DISALLOW_COPY_AND_ASSIGN(PepperWidget);
249 }; 249 };
250 250
251 } // anonymous namespace 251 } // anonymous namespace
252 252
253 // static 253 // static
254 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( 254 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create(
255 int32_t routing_id, 255 int32_t routing_id,
256 int32_t opener_id, 256 const RenderWidget::ShowCallback& show_callback,
257 CompositorDependencies* compositor_deps, 257 CompositorDependencies* compositor_deps,
258 PepperPluginInstanceImpl* plugin, 258 PepperPluginInstanceImpl* plugin,
259 const GURL& active_url, 259 const GURL& active_url,
260 const ScreenInfo& screen_info) { 260 const ScreenInfo& screen_info) {
261 DCHECK_NE(MSG_ROUTING_NONE, routing_id); 261 DCHECK_NE(MSG_ROUTING_NONE, routing_id);
262 DCHECK_NE(MSG_ROUTING_NONE, opener_id); 262 DCHECK(!show_callback.is_null());
263 scoped_refptr<RenderWidgetFullscreenPepper> widget( 263 scoped_refptr<RenderWidgetFullscreenPepper> widget(
264 new RenderWidgetFullscreenPepper(routing_id, compositor_deps, plugin, 264 new RenderWidgetFullscreenPepper(routing_id, compositor_deps, plugin,
265 active_url, screen_info)); 265 active_url, screen_info));
266 widget->Init(opener_id); 266 widget->Init(show_callback, new PepperWidget(widget.get()));
267 widget->AddRef(); 267 widget->AddRef();
268 return widget.get(); 268 return widget.get();
269 } 269 }
270 270
271 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( 271 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper(
272 int32_t routing_id, 272 int32_t routing_id,
273 CompositorDependencies* compositor_deps, 273 CompositorDependencies* compositor_deps,
274 PepperPluginInstanceImpl* plugin, 274 PepperPluginInstanceImpl* plugin,
275 const GURL& active_url, 275 const GURL& active_url,
276 const ScreenInfo& screen_info) 276 const ScreenInfo& screen_info)
277 : RenderWidgetFullscreen(routing_id, compositor_deps, screen_info), 277 : RenderWidget(routing_id,
278 compositor_deps,
279 blink::WebPopupTypeNone,
280 screen_info,
281 false,
282 false,
283 false),
278 active_url_(active_url), 284 active_url_(active_url),
279 plugin_(plugin), 285 plugin_(plugin),
280 layer_(NULL), 286 layer_(NULL),
281 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher(this)) {} 287 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher(this)) {}
282 288
283 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() { 289 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() {
284 } 290 }
285 291
286 void RenderWidgetFullscreenPepper::Invalidate() { 292 void RenderWidgetFullscreenPepper::Invalidate() {
287 InvalidateRect(gfx::Rect(size_.width(), size_.height())); 293 InvalidateRect(gfx::Rect(size_.width(), size_.height()));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 mouse_lock_dispatcher_.get(), 342 mouse_lock_dispatcher_.get(),
337 MouseLockDispatcher::OnLockMouseACK) 343 MouseLockDispatcher::OnLockMouseACK)
338 IPC_MESSAGE_FORWARD(ViewMsg_MouseLockLost, 344 IPC_MESSAGE_FORWARD(ViewMsg_MouseLockLost,
339 mouse_lock_dispatcher_.get(), 345 mouse_lock_dispatcher_.get(),
340 MouseLockDispatcher::OnMouseLockLost) 346 MouseLockDispatcher::OnMouseLockLost)
341 IPC_MESSAGE_UNHANDLED(handled = false) 347 IPC_MESSAGE_UNHANDLED(handled = false)
342 IPC_END_MESSAGE_MAP() 348 IPC_END_MESSAGE_MAP()
343 if (handled) 349 if (handled)
344 return true; 350 return true;
345 351
346 return RenderWidgetFullscreen::OnMessageReceived(msg); 352 return RenderWidget::OnMessageReceived(msg);
347 } 353 }
348 354
349 void RenderWidgetFullscreenPepper::DidInitiatePaint() { 355 void RenderWidgetFullscreenPepper::DidInitiatePaint() {
350 if (plugin_) 356 if (plugin_)
351 plugin_->ViewInitiatedPaint(); 357 plugin_->ViewInitiatedPaint();
352 } 358 }
353 359
354 void RenderWidgetFullscreenPepper::Close() { 360 void RenderWidgetFullscreenPepper::Close() {
355 // If the fullscreen window is closed (e.g. user pressed escape), reset to 361 // If the fullscreen window is closed (e.g. user pressed escape), reset to
356 // normal mode. 362 // normal mode.
357 if (plugin_) 363 if (plugin_)
358 plugin_->FlashSetFullscreen(false, false); 364 plugin_->FlashSetFullscreen(false, false);
359 365
360 // Call Close on the base class to destroy the WebWidget instance. 366 // Call Close on the base class to destroy the WebWidget instance.
361 RenderWidget::Close(); 367 RenderWidget::Close();
362 } 368 }
363 369
364 void RenderWidgetFullscreenPepper::OnResize(const ResizeParams& params) { 370 void RenderWidgetFullscreenPepper::OnResize(const ResizeParams& params) {
365 if (layer_) 371 if (layer_)
366 layer_->setBounds(blink::WebSize(params.new_size)); 372 layer_->setBounds(blink::WebSize(params.new_size));
367 RenderWidget::OnResize(params); 373 RenderWidget::OnResize(params);
368 } 374 }
369 375
370 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
371 return new PepperWidget(this);
372 }
373
374 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { 376 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() {
375 return active_url_; 377 return active_url_;
376 } 378 }
377 379
378 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() { 380 void RenderWidgetFullscreenPepper::OnDeviceScaleFactorChanged() {
379 if (compositor_) 381 if (compositor_)
380 compositor_->setDeviceScaleFactor(device_scale_factor_); 382 compositor_->setDeviceScaleFactor(device_scale_factor_);
381 } 383 }
382 384
383 } // namespace content 385 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | content/renderer/render_widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698