| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "cc/output/copy_output_request.h" |
| 13 #include "cc/output/copy_output_result.h" |
| 12 #include "cc/surfaces/surface.h" | 14 #include "cc/surfaces/surface.h" |
| 13 #include "cc/surfaces/surface_factory.h" | 15 #include "cc/surfaces/surface_factory.h" |
| 14 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
| 15 #include "cc/surfaces/surface_sequence.h" | 17 #include "cc/surfaces/surface_sequence.h" |
| 16 #include "content/browser/accessibility/browser_accessibility_manager.h" | 18 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 17 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 19 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 18 #include "content/browser/compositor/surface_utils.h" | 20 #include "content/browser/compositor/surface_utils.h" |
| 19 #include "content/browser/frame_host/cross_process_frame_connector.h" | 21 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 20 #include "content/browser/gpu/compositor_util.h" | 22 #include "content/browser/gpu/compositor_util.h" |
| 21 #include "content/browser/renderer_host/render_view_host_impl.h" | 23 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 void RenderWidgetHostViewChildFrame::StopSpeaking() { | 421 void RenderWidgetHostViewChildFrame::StopSpeaking() { |
| 420 } | 422 } |
| 421 | 423 |
| 422 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( | 424 bool RenderWidgetHostViewChildFrame::PostProcessEventForPluginIme( |
| 423 const NativeWebKeyboardEvent& event) { | 425 const NativeWebKeyboardEvent& event) { |
| 424 return false; | 426 return false; |
| 425 } | 427 } |
| 426 #endif // defined(OS_MACOSX) | 428 #endif // defined(OS_MACOSX) |
| 427 | 429 |
| 428 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( | 430 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( |
| 429 const gfx::Rect& /* src_subrect */, | 431 const gfx::Rect& src_subrect, |
| 430 const gfx::Size& /* dst_size */, | 432 const gfx::Size& output_size, |
| 431 const ReadbackRequestCallback& callback, | 433 const ReadbackRequestCallback& callback, |
| 432 const SkColorType /* preferred_color_type */) { | 434 const SkColorType preferred_color_type) { |
| 433 callback.Run(SkBitmap(), READBACK_FAILED); | 435 if (!surface_factory_ || surface_id_.is_null()) |
| 436 callback.Run(SkBitmap(), READBACK_FAILED); |
| 437 |
| 438 scoped_ptr<cc::CopyOutputRequest> request = |
| 439 cc::CopyOutputRequest::CreateRequest( |
| 440 base::Bind(&CopyFromCompositingSurfaceHasResult, output_size, |
| 441 preferred_color_type, callback)); |
| 442 if (!src_subrect.IsEmpty()) |
| 443 request->set_area(src_subrect); |
| 444 |
| 445 surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); |
| 434 } | 446 } |
| 435 | 447 |
| 436 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( | 448 void RenderWidgetHostViewChildFrame::CopyFromCompositingSurfaceToVideoFrame( |
| 437 const gfx::Rect& src_subrect, | 449 const gfx::Rect& src_subrect, |
| 438 const scoped_refptr<media::VideoFrame>& target, | 450 const scoped_refptr<media::VideoFrame>& target, |
| 439 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 451 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 440 NOTIMPLEMENTED(); | 452 NOTIMPLEMENTED(); |
| 441 callback.Run(gfx::Rect(), false); | 453 callback.Run(gfx::Rect(), false); |
| 442 } | 454 } |
| 443 | 455 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 #endif | 509 #endif |
| 498 } | 510 } |
| 499 | 511 |
| 500 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { | 512 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { |
| 501 if (surface_factory_ && !surface_id_.is_null()) | 513 if (surface_factory_ && !surface_id_.is_null()) |
| 502 surface_factory_->Destroy(surface_id_); | 514 surface_factory_->Destroy(surface_id_); |
| 503 surface_id_ = cc::SurfaceId(); | 515 surface_id_ = cc::SurfaceId(); |
| 504 } | 516 } |
| 505 | 517 |
| 506 } // namespace content | 518 } // namespace content |
| OLD | NEW |