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.
4 
5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_H_
7 
8 #include <jni.h>
9 
10 #include <memory>
11 
12 #include "base/android/jni_weak_ref.h"
13 #include "base/android/scoped_java_ref.h"
14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h"
16 #include "chrome/browser/ui/android/layouts/scene_layer.h"
17 #include "ui/gfx/geometry/point.h"
18 #include "ui/gfx/geometry/point_f.h"
19 #include "ui/gfx/geometry/size.h"
20 #include "ui/gfx/geometry/size_f.h"
21 
22 namespace android {
23 
24 class ContentLayer;
25 class TabContentManager;
26 
27 // A SceneLayer to render a static tab.
28 class StaticTabSceneLayer : public SceneLayer {
29  public:
30   StaticTabSceneLayer(JNIEnv* env, const base::android::JavaRef<jobject>& jobj);
31   ~StaticTabSceneLayer() override;
32 
33   bool ShouldShowBackground() override;
34   SkColor GetBackgroundColor() override;
35 
36   // Update StaticTabSceneLayer with the new parameters.
37   void UpdateTabLayer(
38       JNIEnv* env,
39       const base::android::JavaParamRef<jobject>& jobj,
40       jint id,
41       jboolean can_use_live_layer,
42       jint default_background_color,
43       jfloat x,
44       jfloat y,
45       jfloat static_to_view_blend,
46       jfloat saturation,
47       jfloat brightness);
48 
49   void SetTabContentManager(
50       JNIEnv* env,
51       const base::android::JavaParamRef<jobject>& jobj,
52       const base::android::JavaParamRef<jobject>& jtab_content_manager);
53 
54  private:
55   scoped_refptr<android::ContentLayer> content_layer_;
56 
57   TabContentManager* tab_content_manager_;
58   int last_set_tab_id_;
59   int background_color_;
60   float brightness_;
61 
62   DISALLOW_COPY_AND_ASSIGN(StaticTabSceneLayer);
63 };
64 
65 }  // namespace android
66 
67 #endif  // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_H_
68