| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/contents/blimp_contents_view_impl.h" | 5 #include "blimp/client/core/contents/blimp_contents_view_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "blimp/client/core/contents/blimp_contents_impl.h" | 10 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 scoped_refptr<cc::Layer> BlimpContentsViewImpl::GetLayer() { | 30 scoped_refptr<cc::Layer> BlimpContentsViewImpl::GetLayer() { |
| 31 return contents_layer_; | 31 return contents_layer_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void BlimpContentsViewImpl::SetSizeAndScale(const gfx::Size& size, | 34 void BlimpContentsViewImpl::SetSizeAndScale(const gfx::Size& size, |
| 35 float device_scale_factor) { | 35 float device_scale_factor) { |
| 36 blimp_contents_->SetSizeAndScale(size, device_scale_factor); | 36 blimp_contents_->SetSizeAndScale(size, device_scale_factor); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool BlimpContentsViewImpl::OnTouchEvent(const ui::MotionEvent& motion_event) { | 39 bool BlimpContentsViewImpl::OnTouchEvent(const ui::MotionEvent& motion_event) { |
| 40 return blimp_contents_->compositor_manager()->OnTouchEvent(motion_event); | 40 return blimp_contents_->document_manager()->OnTouchEvent(motion_event); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void BlimpContentsViewImpl::CopyFromCompositingSurface( | 43 void BlimpContentsViewImpl::CopyFromCompositingSurface( |
| 44 const ReadbackRequestCallback& callback) { | 44 const ReadbackRequestCallback& callback) { |
| 45 blimp_contents_->compositor_manager()->NotifyWhenDonePendingCommits( | 45 blimp_contents_->document_manager()->NotifyWhenDonePendingCommits( |
| 46 base::Bind(&BlimpContentsViewImpl::StartReadbackRequest, | 46 base::Bind(&BlimpContentsViewImpl::StartReadbackRequest, |
| 47 weak_ptr_factory_.GetWeakPtr(), callback)); | 47 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void BlimpContentsViewImpl::StartReadbackRequest( | 50 void BlimpContentsViewImpl::StartReadbackRequest( |
| 51 const ReadbackRequestCallback& callback) { | 51 const ReadbackRequestCallback& callback) { |
| 52 std::unique_ptr<cc::CopyOutputRequest> request = | 52 std::unique_ptr<cc::CopyOutputRequest> request = |
| 53 cc::CopyOutputRequest::CreateBitmapRequest( | 53 cc::CopyOutputRequest::CreateBitmapRequest( |
| 54 base::Bind(&BlimpContentsViewImpl::OnReadbackComplete, | 54 base::Bind(&BlimpContentsViewImpl::OnReadbackComplete, |
| 55 weak_ptr_factory_.GetWeakPtr(), callback)); | 55 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 56 contents_layer_->RequestCopyOfOutput(std::move(request)); | 56 contents_layer_->RequestCopyOfOutput(std::move(request)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void BlimpContentsViewImpl::OnReadbackComplete( | 59 void BlimpContentsViewImpl::OnReadbackComplete( |
| 60 const ReadbackRequestCallback& callback, | 60 const ReadbackRequestCallback& callback, |
| 61 std::unique_ptr<cc::CopyOutputResult> result) { | 61 std::unique_ptr<cc::CopyOutputResult> result) { |
| 62 callback.Run(result->TakeBitmap()); | 62 callback.Run(result->TakeBitmap()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace client | 65 } // namespace client |
| 66 } // namespace blimp | 66 } // namespace blimp |
| OLD | NEW |