| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/html_viewer/web_layer_impl.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "cc/layers/layer.h" | |
| 9 #include "components/mus/public/cpp/view.h" | |
| 10 #include "ui/gfx/geometry/dip_util.h" | |
| 11 #include "ui/mojo/geometry/geometry.mojom.h" | |
| 12 | |
| 13 using blink::WebFloatPoint; | |
| 14 using blink::WebSize; | |
| 15 | |
| 16 namespace html_viewer { | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 // See surface_layer.h for a description of this callback. | |
| 21 void SatisfyCallback(cc::SurfaceSequence sequence) { | |
| 22 // TODO(fsamuel): Implement this. | |
| 23 } | |
| 24 | |
| 25 // See surface_layer.h for a description of this callback. | |
| 26 void RequireCallback(cc::SurfaceId surface_id, | |
| 27 cc::SurfaceSequence sequence) { | |
| 28 // TODO(fsamuel): Implement this. | |
| 29 } | |
| 30 | |
| 31 } | |
| 32 | |
| 33 WebLayerImpl::WebLayerImpl(mus::View* view, float device_pixel_ratio) | |
| 34 : cc_blink::WebLayerImpl( | |
| 35 cc::SurfaceLayer::Create(cc_blink::WebLayerImpl::LayerSettings(), | |
| 36 base::Bind(&SatisfyCallback), | |
| 37 base::Bind(&RequireCallback))), | |
| 38 view_(view), | |
| 39 device_pixel_ratio_(device_pixel_ratio) {} | |
| 40 | |
| 41 WebLayerImpl::~WebLayerImpl() { | |
| 42 } | |
| 43 | |
| 44 void WebLayerImpl::setBounds(const WebSize& size) { | |
| 45 gfx::Size size_in_pixels = | |
| 46 gfx::ScaleToCeiledSize(gfx::Size(size), device_pixel_ratio_); | |
| 47 static_cast<cc::SurfaceLayer*>(layer())-> | |
| 48 SetSurfaceId(cc::SurfaceId(view_->id()), | |
| 49 device_pixel_ratio_, size_in_pixels); | |
| 50 cc_blink::WebLayerImpl::setBounds(size); | |
| 51 } | |
| 52 | |
| 53 } // namespace html_viewer | |
| OLD | NEW |