Use Default PasswordStore with Ozone.
[chromium-blink-merge.git] / cc / layers / ui_resource_layer.h
blob69721a30faadf69435214fa85f5d7c173e06952b
1 // Copyright 2013 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_UI_RESOURCE_LAYER_H_
6 #define CC_LAYERS_UI_RESOURCE_LAYER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/layers/layer.h"
11 #include "cc/resources/ui_resource_client.h"
12 #include "ui/gfx/rect.h"
14 namespace cc {
16 class LayerTreeHost;
17 class ScopedUIResource;
19 class CC_EXPORT UIResourceLayer : public Layer {
20 public:
21 static scoped_refptr<UIResourceLayer> Create();
23 virtual bool DrawsContent() const OVERRIDE;
25 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
27 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
29 void SetBitmap(const SkBitmap& skbitmap);
31 // An alternative way of setting the resource to allow for sharing.
32 void SetUIResourceId(UIResourceId resource_id);
34 // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1).
35 void SetUV(gfx::PointF top_left, gfx::PointF bottom_right);
37 // Sets an opacity value per vertex. It will be multiplied by the layer
38 // opacity value.
39 void SetVertexOpacity(float bottom_left,
40 float top_left,
41 float top_right,
42 float bottom_right);
44 class UIResourceHolder {
45 public:
46 virtual UIResourceId id() = 0;
47 virtual ~UIResourceHolder();
50 protected:
51 UIResourceLayer();
52 virtual ~UIResourceLayer();
54 scoped_ptr<UIResourceHolder> ui_resource_holder_;
55 SkBitmap bitmap_;
57 gfx::PointF uv_top_left_;
58 gfx::PointF uv_bottom_right_;
59 float vertex_opacity_[4];
61 private:
62 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
63 OVERRIDE;
64 void RecreateUIResourceHolder();
68 DISALLOW_COPY_AND_ASSIGN(UIResourceLayer);
71 } // namespace cc
73 #endif // CC_LAYERS_UI_RESOURCE_LAYER_H_