Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / android / compositor / scene_layer / tab_strip_scene_layer.h
blob5647e3c00eaa90040d5cab1441fce18366b20cc9
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_
8 #include <vector>
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"
19 namespace cc {
20 class SolidColorLayer;
23 namespace chrome {
24 namespace android {
26 class LayerTitleCache;
27 class TabHandleLayer;
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 {
32 public:
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,
42 jobject jobj,
43 jfloat width,
44 jfloat height,
45 jfloat y_offset,
46 jfloat background_tab_brightness,
47 jfloat brightness,
48 jboolean should_readd_background);
49 void UpdateNewTabButton(JNIEnv* env,
50 jobject jobj,
51 jint resource_id,
52 jfloat x,
53 jfloat y,
54 jfloat width,
55 jfloat height,
56 jboolean visible,
57 jobject jresource_manager);
58 void UpdateModelSelectorButton(JNIEnv* env,
59 jobject jobj,
60 jint resource_id,
61 jfloat x,
62 jfloat y,
63 jfloat width,
64 jfloat height,
65 jboolean incognito,
66 jboolean visible,
67 jobject jresource_manager);
68 void PutStripTabLayer(JNIEnv* env,
69 jobject jobj,
70 jint id,
71 jint close_resource_id,
72 jint handle_resource_id,
73 jboolean foreground,
74 jboolean close_pressed,
75 jfloat toolbar_width,
76 jfloat x,
77 jfloat y,
78 jfloat width,
79 jfloat height,
80 jfloat content_offset_x,
81 jfloat close_button_alpha,
82 jboolean is_loading,
83 jfloat spinner_rotation,
84 jfloat border_opacity,
85 jobject jlayer_title_cache,
86 jobject jresource_manager);
88 private:
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_;
99 float 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_