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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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"
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.h" 16 #include "content/renderer/pepper/pepper_platform_context_3d.h"
17 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 17 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
18 #include "content/renderer/render_thread_impl.h" 18 #include "content/renderer/render_thread_impl.h"
19 #include "gpu/command_buffer/client/gles2_implementation.h" 19 #include "gpu/command_buffer/client/gles2_implementation.h"
20 #include "skia/ext/platform_canvas.h" 20 #include "skia/ext/platform_canvas.h"
21 #include "third_party/WebKit/public/platform/WebCanvas.h" 21 #include "third_party/WebKit/public/platform/WebCanvas.h"
22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
23 #include "third_party/WebKit/public/platform/WebLayer.h" 23 #include "third_party/WebKit/public/platform/WebLayer.h"
24 #include "third_party/WebKit/public/platform/WebSize.h" 24 #include "third_party/WebKit/public/platform/WebSize.h"
25 #include "third_party/WebKit/public/web/WebCursorInfo.h" 25 #include "third_party/WebKit/public/web/WebCursorInfo.h"
26 #include "third_party/WebKit/public/web/WebWidget.h" 26 #include "third_party/WebKit/public/web/WebWidget.h"
27 #include "ui/gfx/size_conversions.h" 27 #include "ui/gfx/size_conversions.h"
28 #include "ui/gl/gpu_preference.h" 28 #include "ui/gl/gpu_preference.h"
29 29
30 using WebKit::WebCanvas; 30 using blink::WebCanvas;
31 using WebKit::WebCompositionUnderline; 31 using blink::WebCompositionUnderline;
32 using WebKit::WebCursorInfo; 32 using blink::WebCursorInfo;
33 using WebKit::WebGestureEvent; 33 using blink::WebGestureEvent;
34 using WebKit::WebInputEvent; 34 using blink::WebInputEvent;
35 using WebKit::WebMouseEvent; 35 using blink::WebMouseEvent;
36 using WebKit::WebMouseWheelEvent; 36 using blink::WebMouseWheelEvent;
37 using WebKit::WebPoint; 37 using blink::WebPoint;
38 using WebKit::WebRect; 38 using blink::WebRect;
39 using WebKit::WebSize; 39 using blink::WebSize;
40 using WebKit::WebString; 40 using blink::WebString;
41 using WebKit::WebTextDirection; 41 using blink::WebTextDirection;
42 using WebKit::WebTextInputType; 42 using blink::WebTextInputType;
43 using WebKit::WebVector; 43 using blink::WebVector;
44 using WebKit::WebWidget; 44 using blink::WebWidget;
45 using WebKit::WGC3Dintptr; 45 using blink::WGC3Dintptr;
46 46
47 namespace content { 47 namespace content {
48 48
49 namespace { 49 namespace {
50 50
51 class FullscreenMouseLockDispatcher : public MouseLockDispatcher { 51 class FullscreenMouseLockDispatcher : public MouseLockDispatcher {
52 public: 52 public:
53 explicit FullscreenMouseLockDispatcher(RenderWidgetFullscreenPepper* widget); 53 explicit FullscreenMouseLockDispatcher(RenderWidgetFullscreenPepper* widget);
54 virtual ~FullscreenMouseLockDispatcher(); 54 virtual ~FullscreenMouseLockDispatcher();
55 55
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 virtual bool compositionRange(size_t* location, size_t* length) { 303 virtual bool compositionRange(size_t* location, size_t* length) {
304 return false; 304 return false;
305 } 305 }
306 306
307 virtual bool confirmComposition(const WebString& text) { 307 virtual bool confirmComposition(const WebString& text) {
308 return false; 308 return false;
309 } 309 }
310 310
311 virtual WebTextInputType textInputType() { 311 virtual WebTextInputType textInputType() {
312 return WebKit::WebTextInputTypeNone; 312 return blink::WebTextInputTypeNone;
313 } 313 }
314 314
315 virtual WebRect caretOrSelectionBounds() { 315 virtual WebRect caretOrSelectionBounds() {
316 return WebRect(); 316 return WebRect();
317 } 317 }
318 318
319 virtual bool selectionRange(WebPoint& start, WebPoint& end) const { 319 virtual bool selectionRange(WebPoint& start, WebPoint& end) const {
320 return false; 320 return false;
321 } 321 }
322 322
(...skipping 15 matching lines...) Expand all
338 DISALLOW_COPY_AND_ASSIGN(PepperWidget); 338 DISALLOW_COPY_AND_ASSIGN(PepperWidget);
339 }; 339 };
340 340
341 } // anonymous namespace 341 } // anonymous namespace
342 342
343 // static 343 // static
344 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( 344 RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create(
345 int32 opener_id, 345 int32 opener_id,
346 PepperPluginInstanceImpl* plugin, 346 PepperPluginInstanceImpl* plugin,
347 const GURL& active_url, 347 const GURL& active_url,
348 const WebKit::WebScreenInfo& screen_info) { 348 const blink::WebScreenInfo& screen_info) {
349 DCHECK_NE(MSG_ROUTING_NONE, opener_id); 349 DCHECK_NE(MSG_ROUTING_NONE, opener_id);
350 scoped_refptr<RenderWidgetFullscreenPepper> widget( 350 scoped_refptr<RenderWidgetFullscreenPepper> widget(
351 new RenderWidgetFullscreenPepper(plugin, active_url, screen_info)); 351 new RenderWidgetFullscreenPepper(plugin, active_url, screen_info));
352 widget->Init(opener_id); 352 widget->Init(opener_id);
353 widget->AddRef(); 353 widget->AddRef();
354 return widget.get(); 354 return widget.get();
355 } 355 }
356 356
357 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper( 357 RenderWidgetFullscreenPepper::RenderWidgetFullscreenPepper(
358 PepperPluginInstanceImpl* plugin, 358 PepperPluginInstanceImpl* plugin,
359 const GURL& active_url, 359 const GURL& active_url,
360 const WebKit::WebScreenInfo& screen_info) 360 const blink::WebScreenInfo& screen_info)
361 : RenderWidgetFullscreen(screen_info), 361 : RenderWidgetFullscreen(screen_info),
362 active_url_(active_url), 362 active_url_(active_url),
363 plugin_(plugin), 363 plugin_(plugin),
364 layer_(NULL), 364 layer_(NULL),
365 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher( 365 mouse_lock_dispatcher_(new FullscreenMouseLockDispatcher(
366 this)) { 366 this)) {
367 } 367 }
368 368
369 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() { 369 RenderWidgetFullscreenPepper::~RenderWidgetFullscreenPepper() {
370 } 370 }
371 371
372 void RenderWidgetFullscreenPepper::Invalidate() { 372 void RenderWidgetFullscreenPepper::Invalidate() {
373 InvalidateRect(gfx::Rect(size_.width(), size_.height())); 373 InvalidateRect(gfx::Rect(size_.width(), size_.height()));
374 } 374 }
375 375
376 void RenderWidgetFullscreenPepper::InvalidateRect(const WebKit::WebRect& rect) { 376 void RenderWidgetFullscreenPepper::InvalidateRect(const blink::WebRect& rect) {
377 didInvalidateRect(rect); 377 didInvalidateRect(rect);
378 } 378 }
379 379
380 void RenderWidgetFullscreenPepper::ScrollRect( 380 void RenderWidgetFullscreenPepper::ScrollRect(
381 int dx, int dy, const WebKit::WebRect& rect) { 381 int dx, int dy, const blink::WebRect& rect) {
382 didScrollRect(dx, dy, rect); 382 didScrollRect(dx, dy, rect);
383 } 383 }
384 384
385 void RenderWidgetFullscreenPepper::Destroy() { 385 void RenderWidgetFullscreenPepper::Destroy() {
386 // This function is called by the plugin instance as it's going away, so reset 386 // This function is called by the plugin instance as it's going away, so reset
387 // plugin_ to NULL to avoid calling into a dangling pointer e.g. on Close(). 387 // plugin_ to NULL to avoid calling into a dangling pointer e.g. on Close().
388 plugin_ = NULL; 388 plugin_ = NULL;
389 389
390 // After calling Destroy(), the plugin instance assumes that the layer is not 390 // After calling Destroy(), the plugin instance assumes that the layer is not
391 // used by us anymore, so it may destroy the layer before this object goes 391 // used by us anymore, so it may destroy the layer before this object goes
392 // away. 392 // away.
393 SetLayer(NULL); 393 SetLayer(NULL);
394 394
395 Send(new ViewHostMsg_Close(routing_id_)); 395 Send(new ViewHostMsg_Close(routing_id_));
396 Release(); 396 Release();
397 } 397 }
398 398
399 void RenderWidgetFullscreenPepper::DidChangeCursor( 399 void RenderWidgetFullscreenPepper::DidChangeCursor(
400 const WebKit::WebCursorInfo& cursor) { 400 const blink::WebCursorInfo& cursor) {
401 didChangeCursor(cursor); 401 didChangeCursor(cursor);
402 } 402 }
403 403
404 void RenderWidgetFullscreenPepper::SetLayer(WebKit::WebLayer* layer) { 404 void RenderWidgetFullscreenPepper::SetLayer(blink::WebLayer* layer) {
405 layer_ = layer; 405 layer_ = layer;
406 bool compositing = !!layer_; 406 bool compositing = !!layer_;
407 if (compositing != is_accelerated_compositing_active_) { 407 if (compositing != is_accelerated_compositing_active_) {
408 if (compositing) { 408 if (compositing) {
409 if (!layerTreeView()) 409 if (!layerTreeView())
410 initializeLayerTreeView(); 410 initializeLayerTreeView();
411 if (!layerTreeView()) 411 if (!layerTreeView())
412 return; 412 return;
413 layer_->setBounds(WebKit::WebSize(size())); 413 layer_->setBounds(blink::WebSize(size()));
414 layer_->setDrawsContent(true); 414 layer_->setDrawsContent(true);
415 compositor_->setDeviceScaleFactor(device_scale_factor_); 415 compositor_->setDeviceScaleFactor(device_scale_factor_);
416 compositor_->setRootLayer(*layer_); 416 compositor_->setRootLayer(*layer_);
417 didActivateCompositor(-1); 417 didActivateCompositor(-1);
418 } else { 418 } else {
419 didDeactivateCompositor(); 419 didDeactivateCompositor();
420 } 420 }
421 } 421 }
422 } 422 }
423 423
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 if (plugin_ && plugin_->GetBitmapForOptimizedPluginPaint( 468 if (plugin_ && plugin_->GetBitmapForOptimizedPluginPaint(
469 paint_bounds, dib, location, clip, scale_factor)) { 469 paint_bounds, dib, location, clip, scale_factor)) {
470 return plugin_; 470 return plugin_;
471 } 471 }
472 return NULL; 472 return NULL;
473 } 473 }
474 474
475 void RenderWidgetFullscreenPepper::OnResize( 475 void RenderWidgetFullscreenPepper::OnResize(
476 const ViewMsg_Resize_Params& params) { 476 const ViewMsg_Resize_Params& params) {
477 if (layer_) 477 if (layer_)
478 layer_->setBounds(WebKit::WebSize(params.new_size)); 478 layer_->setBounds(blink::WebSize(params.new_size));
479 RenderWidget::OnResize(params); 479 RenderWidget::OnResize(params);
480 } 480 }
481 481
482 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() { 482 WebWidget* RenderWidgetFullscreenPepper::CreateWebWidget() {
483 return new PepperWidget(this); 483 return new PepperWidget(this);
484 } 484 }
485 485
486 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() { 486 GURL RenderWidgetFullscreenPepper::GetURLForGraphicsContext3D() {
487 return active_url_; 487 return active_url_;
488 } 488 }
489 489
490 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor( 490 void RenderWidgetFullscreenPepper::SetDeviceScaleFactor(
491 float device_scale_factor) { 491 float device_scale_factor) {
492 RenderWidget::SetDeviceScaleFactor(device_scale_factor); 492 RenderWidget::SetDeviceScaleFactor(device_scale_factor);
493 if (compositor_) 493 if (compositor_)
494 compositor_->setDeviceScaleFactor(device_scale_factor); 494 compositor_->setDeviceScaleFactor(device_scale_factor);
495 } 495 }
496 496
497 } // namespace content 497 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget_fullscreen_pepper.h ('k') | content/renderer/renderer_date_time_picker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698