ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / chrome / browser / android / compositor / layer / content_layer.h
blobc262d253bd5166f1432134ec4207beaf5e1820c6
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 CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/android/compositor/layer/layer.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h"
14 namespace cc {
15 class Layer;
18 namespace chrome {
19 namespace android {
21 class TabContentManager;
22 class ThumbnailLayer;
24 // Sub layer tree representation of the contents of a tab.
25 // Contains logic to temporarily display a static thumbnail
26 // when the content layer is not available.
27 // To specialize call SetProperties.
28 class ContentLayer : public Layer {
29 public:
30 static scoped_refptr<ContentLayer> Create(
31 TabContentManager* tab_content_manager);
32 void SetProperties(int id,
33 bool can_use_live_layer,
34 bool can_use_ntp_fallback,
35 float static_to_view_blend,
36 bool should_override_content_alpha,
37 float content_alpha_override,
38 float saturation,
39 const gfx::Rect& desired_bounds,
40 const gfx::Size& content_size);
41 bool ShowingLiveLayer() { return !static_attached_ && content_attached_; }
42 gfx::Size GetContentSize();
44 scoped_refptr<cc::Layer> layer() override;
46 protected:
47 explicit ContentLayer(TabContentManager* tab_content_manager);
48 ~ContentLayer() override;
50 private:
51 void SetContentLayer(scoped_refptr<cc::Layer> layer);
52 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer);
53 void ClipContentLayer(scoped_refptr<cc::Layer> content_layer,
54 gfx::Rect clipping,
55 gfx::Size content_size);
56 void ClipStaticLayer(scoped_refptr<ThumbnailLayer> static_layer,
57 gfx::Rect clipping);
59 scoped_refptr<cc::Layer> layer_;
60 scoped_refptr<ThumbnailLayer> static_layer_;
61 bool content_attached_;
62 bool static_attached_;
63 float saturation_;
65 TabContentManager* tab_content_manager_;
67 DISALLOW_COPY_AND_ASSIGN(ContentLayer);
70 } // namespace android
71 } // namespace chrome
73 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_