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"
21 class TabContentManager
;
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
{
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
,
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
;
47 explicit ContentLayer(TabContentManager
* tab_content_manager
);
48 ~ContentLayer() override
;
51 void SetContentLayer(scoped_refptr
<cc::Layer
> layer
);
52 void SetStaticLayer(scoped_refptr
<ThumbnailLayer
> layer
);
53 void ClipContentLayer(scoped_refptr
<cc::Layer
> content_layer
,
55 gfx::Size content_size
);
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_
;
65 TabContentManager
* tab_content_manager_
;
67 DISALLOW_COPY_AND_ASSIGN(ContentLayer
);
70 } // namespace android
73 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_