Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / android / compositor / layer / content_layer.h
blob0e3f1e960e1c84c676a249903bc3e90531b1d4a7
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 "cc/output/filter_operations.h"
11 #include "chrome/browser/android/compositor/layer/layer.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/geometry/size.h"
15 namespace cc {
16 class Layer;
19 namespace chrome {
20 namespace android {
22 class TabContentManager;
23 class ThumbnailLayer;
25 // Sub layer tree representation of the contents of a tab.
26 // Contains logic to temporarily display a static thumbnail
27 // when the content layer is not available.
28 // To specialize call SetProperties.
29 class ContentLayer : public Layer {
30 public:
31 static scoped_refptr<ContentLayer> Create(
32 TabContentManager* tab_content_manager);
33 void SetProperties(int id,
34 bool can_use_live_layer,
35 bool can_use_ntp_fallback,
36 float static_to_view_blend,
37 bool should_override_content_alpha,
38 float content_alpha_override,
39 float saturation,
40 const gfx::Rect& desired_bounds,
41 const gfx::Size& content_size);
42 bool ShowingLiveLayer() { return !static_attached_ && content_attached_; }
43 gfx::Size GetContentSize();
45 scoped_refptr<cc::Layer> layer() override;
47 protected:
48 explicit ContentLayer(TabContentManager* tab_content_manager);
49 ~ContentLayer() override;
51 private:
52 void SetContentLayer(scoped_refptr<cc::Layer> layer);
53 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer);
54 void ClipContentLayer(scoped_refptr<cc::Layer> content_layer,
55 gfx::Rect clipping);
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_;
64 cc::FilterOperations static_filter_operations_;
65 cc::FilterOperations content_filter_operations_;
67 TabContentManager* tab_content_manager_;
69 DISALLOW_COPY_AND_ASSIGN(ContentLayer);
72 } // namespace android
73 } // namespace chrome
75 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_