1 // Copyright 2015 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_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_H_
10 #include "base/android/jni_android.h"
11 #include "base/android/jni_weak_ref.h"
12 #include "base/android/scoped_java_ref.h"
13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "cc/layers/layer.h"
16 #include "cc/layers/ui_resource_layer.h"
17 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h"
20 class SolidColorLayer
;
26 class LayerTitleCache
;
29 // A scene layer to draw one or more tab strips. Note that content tree can be
30 // added as a subtree.
31 class TabStripSceneLayer
: public SceneLayer
{
33 TabStripSceneLayer(JNIEnv
* env
, jobject jobj
);
34 ~TabStripSceneLayer() override
;
36 void SetContentTree(JNIEnv
* env
, jobject jobj
, jobject jcontent_tree
);
38 void BeginBuildingFrame(JNIEnv
* env
, jobject jobj
, jboolean visible
);
39 void FinishBuildingFrame(JNIEnv
* env
, jobject jobj
);
41 void UpdateTabStripLayer(JNIEnv
* env
,
46 jfloat background_tab_brightness
,
48 jboolean should_readd_background
);
49 void UpdateNewTabButton(JNIEnv
* env
,
57 jobject jresource_manager
);
58 void UpdateModelSelectorButton(JNIEnv
* env
,
67 jobject jresource_manager
);
68 void PutStripTabLayer(JNIEnv
* env
,
71 jint close_resource_id
,
72 jint handle_resource_id
,
74 jboolean close_pressed
,
80 jfloat content_offset_x
,
81 jfloat close_button_alpha
,
83 jfloat spinner_rotation
,
84 jfloat border_opacity
,
85 jobject jlayer_title_cache
,
86 jobject jresource_manager
);
89 scoped_refptr
<TabHandleLayer
> GetNextLayer(
90 LayerTitleCache
* layer_title_cache
);
92 typedef std::vector
<scoped_refptr
<TabHandleLayer
>> TabHandleLayerList
;
94 scoped_refptr
<cc::SolidColorLayer
> tab_strip_layer_
;
95 scoped_refptr
<cc::UIResourceLayer
> new_tab_button_
;
96 scoped_refptr
<cc::UIResourceLayer
> model_selector_button_
;
98 float background_tab_brightness_
;
100 unsigned write_index_
;
101 TabHandleLayerList tab_handle_layers_
;
102 SceneLayer
* content_tree_
;
104 DISALLOW_COPY_AND_ASSIGN(TabStripSceneLayer
);
107 bool RegisterTabStripSceneLayer(JNIEnv
* env
);
109 } // namespace android
110 } // namespace chrome
112 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TAB_STRIP_SCENE_LAYER_H_