summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/web_layer_impl.cc
blob: 345e1fa873bf4c2efd563e01f490f685082917d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/html_viewer/web_layer_impl.h"

#include "base/bind.h"
#include "cc/layers/layer.h"
#include "components/mus/public/cpp/view.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/mojo/geometry/geometry.mojom.h"

using blink::WebFloatPoint;
using blink::WebSize;

namespace html_viewer {

namespace {

// See surface_layer.h for a description of this callback.
void SatisfyCallback(cc::SurfaceSequence sequence) {
  // TODO(fsamuel): Implement this.
}

// See surface_layer.h for a description of this callback.
void RequireCallback(cc::SurfaceId surface_id,
                     cc::SurfaceSequence sequence) {
  // TODO(fsamuel): Implement this.
}

}

WebLayerImpl::WebLayerImpl(mojo::View* view, float device_pixel_ratio)
    : cc_blink::WebLayerImpl(cc::SurfaceLayer::Create(
          cc_blink::WebLayerImpl::LayerSettings(),
          base::Bind(&SatisfyCallback),
          base::Bind(&RequireCallback))),
      view_(view),
      device_pixel_ratio_(device_pixel_ratio) {
}

WebLayerImpl::~WebLayerImpl() {
}

void WebLayerImpl::setBounds(const WebSize& size) {
  static_cast<cc::SurfaceLayer*>(layer())->
      SetSurfaceId(cc::SurfaceId(view_->id()),
                   device_pixel_ratio_, size);
  cc_blink::WebLayerImpl::setBounds(size);
}

}  // namespace html_viewer