Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / layers / surface_layer.h
blobd30d3085803d5ddb5357695e6c9b38b8df0572b8
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
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_SURFACE_LAYER_H_
6 #define CC_LAYERS_SURFACE_LAYER_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/layers/layer.h"
10 #include "cc/surfaces/surface_id.h"
11 #include "cc/surfaces/surface_sequence.h"
12 #include "ui/gfx/geometry/size.h"
14 namespace cc {
16 // A layer that renders a surface referencing the output of another compositor
17 // instance or client.
18 class CC_EXPORT SurfaceLayer : public Layer {
19 public:
20 // This callback is run when a SurfaceSequence needs to be satisfied, but
21 // the parent compositor is unable to. It can be called on either the main
22 // or impl threads.
23 using SatisfyCallback = base::Callback<void(SurfaceSequence)>;
25 // This callback is run to require that a specific SurfaceSequence is
26 // received before a SurfaceId is destroyed.
27 using RequireCallback = base::Callback<void(SurfaceId, SurfaceSequence)>;
29 static scoped_refptr<SurfaceLayer> Create(
30 const LayerSettings& settings,
31 const SatisfyCallback& satisfy_callback,
32 const RequireCallback& require_callback);
34 void SetSurfaceId(SurfaceId surface_id, float scale, const gfx::Size& size);
36 // Layer overrides.
37 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
38 void SetLayerTreeHost(LayerTreeHost* host) override;
39 void PushPropertiesTo(LayerImpl* layer) override;
40 void CalculateContentsScale(float ideal_contents_scale,
41 float* contents_scale_x,
42 float* contents_scale_y,
43 gfx::Size* content_bounds) override;
45 protected:
46 SurfaceLayer(const LayerSettings& settings,
47 const SatisfyCallback& satisfy_callback,
48 const RequireCallback& require_callback);
49 bool HasDrawableContent() const override;
51 private:
52 ~SurfaceLayer() override;
53 void CreateNewDestroySequence();
54 void SatisfyDestroySequence();
56 SurfaceId surface_id_;
57 gfx::Size surface_size_;
58 float surface_scale_;
59 SurfaceSequence destroy_sequence_;
60 SatisfyCallback satisfy_callback_;
61 RequireCallback require_callback_;
63 DISALLOW_COPY_AND_ASSIGN(SurfaceLayer);
66 } // namespace cc
68 #endif // CC_LAYERS_SURFACE_LAYER_H_