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"
22 class TabContentManager
;
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
{
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
,
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
;
48 explicit ContentLayer(TabContentManager
* tab_content_manager
);
49 ~ContentLayer() override
;
52 void SetContentLayer(scoped_refptr
<cc::Layer
> layer
);
53 void SetStaticLayer(scoped_refptr
<ThumbnailLayer
> layer
);
54 void ClipContentLayer(scoped_refptr
<cc::Layer
> content_layer
,
56 void ClipStaticLayer(scoped_refptr
<ThumbnailLayer
> static_layer
,
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
75 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_