| 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/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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "content/common/gpu/client/gpu_channel_host.h" | 12 #include "content/common/gpu/client/gpu_channel_host.h" |
| 13 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
| 14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 15 #include "content/renderer/gpu/render_widget_compositor.h" | 15 #include "content/renderer/gpu/render_widget_compositor.h" |
| 16 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" | 16 #include "content/renderer/pepper/pepper_platform_context_3d_impl.h" |
| 17 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
| 18 #include "gpu/command_buffer/client/gles2_implementation.h" | 18 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 19 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
| 20 #include "third_party/WebKit/public/platform/WebCanvas.h" | 20 #include "third_party/WebKit/public/platform/WebCanvas.h" |
| 21 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 21 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 22 #include "third_party/WebKit/public/platform/WebLayer.h" | 22 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 23 #include "third_party/WebKit/public/platform/WebSize.h" | 23 #include "third_party/WebKit/public/platform/WebSize.h" |
| 24 #include "third_party/WebKit/public/web/WebCursorInfo.h" | 24 #include "third_party/WebKit/public/web/WebCursorInfo.h" |
| 25 #include "third_party/WebKit/public/web/WebWidget.h" | 25 #include "third_party/WebKit/public/web/WebWidget.h" |
| 26 #include "ui/gfx/size_conversions.h" | 26 #include "ui/gfx/size_conversions.h" |
| 27 #include "ui/gl/gpu_preference.h" | 27 #include "ui/gl/gpu_preference.h" |
| 28 #include "webkit/plugins/ppapi/plugin_delegate.h" | 28 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 29 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 29 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 30 | 30 |
| 31 using WebKit::WebCanvas; | 31 using WebKit::WebCanvas; |
| 32 using WebKit::WebCompositionUnderline; | 32 using WebKit::WebCompositionUnderline; |
| 33 using WebKit::WebCursorInfo; | 33 using WebKit::WebCursorInfo; |
| 34 using WebKit::WebGestureEvent; | 34 using WebKit::WebGestureEvent; |
| 35 using WebKit::WebInputEvent; | 35 using WebKit::WebInputEvent; |
| 36 using WebKit::WebMouseEvent; | 36 using WebKit::WebMouseEvent; |
| 37 using WebKit::WebMouseWheelEvent; | 37 using WebKit::WebMouseWheelEvent; |
| 38 using WebKit::WebPoint; | 38 using WebKit::WebPoint; |
| 39 using WebKit::WebRect; | 39 using WebKit::WebRect; |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 RenderWidgetFullscreenPepper* widget_; | 341 RenderWidgetFullscreenPepper* widget_; |
| 342 WebSize size_; | 342 WebSize size_; |
| 343 | 343 |
| 344 DISALLOW_COPY_AND_ASSIGN(PepperWidget); | 344 DISALLOW_COPY_AND_ASSIGN(PepperWidget); |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 } // anonymous namespace | 347 } // anonymous namespace |
| 348 | 348 |
| 349 // static | 349 // static |
| 350 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( | 350 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( |
| 351 int32 opener_id, webkit::ppapi::PluginInstance* plugin, | 351 int32 opener_id, webkit::ppapi::PluginInstanceImpl* plugin, |
| 352 const GURL& active_url, | 352 const GURL& active_url, |
| 353 const WebKit::WebScreenInfo& screen_info) { | 353 const WebKit::WebScreenInfo& screen_info) { |
| 354 DCHECK_NE(MSG_ROUTING_NONE, opener_id); | 354 DCHECK_NE(MSG_ROUTING_NONE, opener_id); |
| 355 scoped_refptr<RenderWidgetFullscreenPepper> widget( | 355 scoped_refptr<RenderWidgetFullscreenPepper> widget( |
| 356 new RenderWidgetFullscreenPepper(plugin, active_url, screen_info)); | 356 new RenderWidgetFullscreenPepper(plugin, active_url, screen_info)); |
| 357 widget->Init(opener_id); | 357 widget->Init(opener_id); |
| 358 widget->AddRef(); | 358 widget->AddRef(); |
| 359 return widget.get(); | 359 return widget.get(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( | 362 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( |
| 363 webkit::ppapi::PluginInstance* plugin, | 363 webkit::ppapi::PluginInstanceImpl* plugin, |
| 364 const GURL& active_url, | 364 const GURL& active_url, |
| 365 const WebKit::WebScreenInfo& screen_info) | 365 const WebKit::WebScreenInfo& screen_info) |
| 366 : RenderWidgetFullscreen(screen_info), | 366 : RenderWidgetFullscreen(screen_info), |
| 367 active_url_(active_url), | 367 active_url_(active_url), |
| 368 plugin_(plugin), | 368 plugin_(plugin), |
| 369 layer_(NULL), | 369 layer_(NULL), |
| 370 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher( | 370 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher( |
| 371 this)) { | 371 this)) { |
| 372 } | 372 } |
| 373 | 373 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 void RenderWidgetFullscreenPepper::Close() { | 460 void RenderWidgetFullscreenPepper::Close() { |
| 461 // If the fullscreen window is closed (e.g. user pressed escape), reset to | 461 // If the fullscreen window is closed (e.g. user pressed escape), reset to |
| 462 // normal mode. | 462 // normal mode. |
| 463 if (plugin_) | 463 if (plugin_) |
| 464 plugin_->FlashSetFullscreen(false, false); | 464 plugin_->FlashSetFullscreen(false, false); |
| 465 | 465 |
| 466 // Call Close on the base class to destroy the WebWidget instance. | 466 // Call Close on the base class to destroy the WebWidget instance. |
| 467 RenderWidget::Close(); | 467 RenderWidget::Close(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 webkit::ppapi::PluginInstance* | 470 webkit::ppapi::PluginInstanceImpl* |
| 471 RenderWidgetFullscreenPepper::GetBitmapForOptimizedPluginPaint( | 471 RenderWidgetFullscreenPepper::GetBitmapForOptimizedPluginPaint( |
| 472 const gfx::Rect& paint_bounds, | 472 const gfx::Rect& paint_bounds, |
| 473 TransportDIB** dib, | 473 TransportDIB** dib, |
| 474 gfx::Rect* location, | 474 gfx::Rect* location, |
| 475 gfx::Rect* clip, | 475 gfx::Rect* clip, |
| 476 float* scale_factor) { | 476 float* scale_factor) { |
| 477 if (plugin_ && plugin_->GetBitmapForOptimizedPluginPaint( | 477 if (plugin_ && plugin_->GetBitmapForOptimizedPluginPaint( |
| 478 paint_bounds, dib, location, clip, scale_factor)) { | 478 paint_bounds, dib, location, clip, scale_factor)) { |
| 479 return plugin_; | 479 return plugin_; |
| 480 } | 480 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 497 } | 497 } |
| 498 | 498 |
| 499 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( | 499 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( |
| 500 float device_scale_factor) { | 500 float device_scale_factor) { |
| 501 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 501 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 502 if (compositor_) | 502 if (compositor_) |
| 503 compositor_->setDeviceScaleFactor(device_scale_factor); | 503 compositor_->setDeviceScaleFactor(device_scale_factor); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace content | 506 } // namespace content |
| OLD | NEW |