| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TOOLBAR_SCENE_LAYER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_H_ | 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TOOLBAR_SCENE_LAYER_H_ |
| 7 | |
| 8 #include <jni.h> | |
| 9 | 7 |
| 10 #include <memory> | 8 #include <memory> |
| 9 #include <vector> |
| 11 | 10 |
| 11 #include "base/android/jni_android.h" |
| 12 #include "base/android/jni_weak_ref.h" | 12 #include "base/android/jni_weak_ref.h" |
| 13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | |
| 16 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" | 15 #include "chrome/browser/android/compositor/scene_layer/scene_layer.h" |
| 17 #include "ui/gfx/geometry/point.h" | 16 #include "ui/android/resources/resource_manager_impl.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 | 17 |
| 22 namespace cc { | 18 namespace cc { |
| 23 class Layer; | 19 class Layer; |
| 20 class SolidColorLayer; |
| 24 } | 21 } |
| 25 | 22 |
| 26 namespace chrome { | 23 namespace chrome { |
| 27 namespace android { | 24 namespace android { |
| 28 | 25 |
| 29 class ContentLayer; | |
| 30 class ToolbarLayer; | 26 class ToolbarLayer; |
| 31 | 27 |
| 32 // A SceneLayer to render a static tab. | 28 class ToolbarSceneLayer : public SceneLayer { |
| 33 class StaticTabSceneLayer : public SceneLayer { | |
| 34 public: | 29 public: |
| 35 StaticTabSceneLayer(JNIEnv* env, jobject jobj); | 30 ToolbarSceneLayer(JNIEnv* env, jobject jobj); |
| 36 ~StaticTabSceneLayer() override; | 31 ~ToolbarSceneLayer() override; |
| 37 | 32 |
| 38 bool ShouldShowBackground() override; | |
| 39 SkColor GetBackgroundColor() override; | |
| 40 | |
| 41 // Update StaticTabSceneLayer with the new parameters. | |
| 42 void UpdateTabLayer( | |
| 43 JNIEnv* env, | |
| 44 const base::android::JavaParamRef<jobject>& jobj, | |
| 45 jfloat content_viewport_x, | |
| 46 jfloat content_viewport_y, | |
| 47 jfloat content_viewport_width, | |
| 48 jfloat content_viewport_height, | |
| 49 const base::android::JavaParamRef<jobject>& jtab_content_manager, | |
| 50 jint id, | |
| 51 jint toolbar_resource_id, | |
| 52 jboolean can_use_live_layer, | |
| 53 jint default_background_color, | |
| 54 jfloat x, | |
| 55 jfloat y, | |
| 56 jfloat width, | |
| 57 jfloat height, | |
| 58 jfloat content_offset_y, | |
| 59 jfloat static_to_view_blend, | |
| 60 jfloat saturation, | |
| 61 jfloat brightness); | |
| 62 // Update the compositor version of the toolbar. | 33 // Update the compositor version of the toolbar. |
| 63 void UpdateToolbarLayer( | 34 void UpdateToolbarLayer( |
| 64 JNIEnv* env, | 35 JNIEnv* env, |
| 65 const base::android::JavaParamRef<jobject>& object, | 36 const base::android::JavaParamRef<jobject>& object, |
| 66 const base::android::JavaParamRef<jobject>& jresource_manager, | 37 const base::android::JavaParamRef<jobject>& jresource_manager, |
| 67 jint toolbar_resource_id, | 38 jint toolbar_resource_id, |
| 68 jint toolbar_background_color, | 39 jint toolbar_background_color, |
| 69 jint url_bar_resource_id, | 40 jint url_bar_resource_id, |
| 70 jfloat url_bar_alpha, | 41 jfloat url_bar_alpha, |
| 71 jfloat top_offset, | 42 jfloat top_offset, |
| 72 bool visible, | 43 bool visible, |
| 73 bool show_shadow); | 44 bool show_shadow); |
| 45 |
| 74 // Update the progress bar. | 46 // Update the progress bar. |
| 75 void UpdateProgressBar( | 47 void UpdateProgressBar( |
| 76 JNIEnv* env, | 48 JNIEnv* env, |
| 77 const base::android::JavaParamRef<jobject>& object, | 49 const base::android::JavaParamRef<jobject>& object, |
| 78 jint progress_bar_x, | 50 jint progress_bar_x, |
| 79 jint progress_bar_y, | 51 jint progress_bar_y, |
| 80 jint progress_bar_width, | 52 jint progress_bar_width, |
| 81 jint progress_bar_height, | 53 jint progress_bar_height, |
| 82 jint progress_bar_color, | 54 jint progress_bar_color, |
| 83 jint progress_bar_background_x, | 55 jint progress_bar_background_x, |
| 84 jint progress_bar_background_y, | 56 jint progress_bar_background_y, |
| 85 jint progress_bar_background_width, | 57 jint progress_bar_background_width, |
| 86 jint progress_bar_background_height, | 58 jint progress_bar_background_height, |
| 87 jint progress_bar_background_color); | 59 jint progress_bar_background_color); |
| 88 | 60 |
| 61 void SetContentTree( |
| 62 JNIEnv* env, |
| 63 const base::android::JavaParamRef<jobject>& jobj, |
| 64 const base::android::JavaParamRef<jobject>& jcontent_tree); |
| 65 |
| 66 SkColor GetBackgroundColor() override; |
| 67 |
| 68 bool ShouldShowBackground() override; |
| 69 |
| 89 private: | 70 private: |
| 90 scoped_refptr<chrome::android::ContentLayer> content_layer_; | 71 bool should_show_background_; |
| 91 scoped_refptr<cc::Layer> content_scene_layer_; | 72 SkColor background_color_; |
| 73 scoped_refptr<cc::Layer> content_container_; |
| 92 scoped_refptr<ToolbarLayer> toolbar_layer_; | 74 scoped_refptr<ToolbarLayer> toolbar_layer_; |
| 93 | 75 |
| 94 int last_set_tab_id_; | 76 DISALLOW_COPY_AND_ASSIGN(ToolbarSceneLayer); |
| 95 int background_color_; | |
| 96 float brightness_; | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(StaticTabSceneLayer); | |
| 99 }; | 77 }; |
| 100 | 78 |
| 101 bool RegisterStaticTabSceneLayer(JNIEnv* env); | 79 bool RegisterToolbarSceneLayer(JNIEnv* env); |
| 102 | 80 |
| 103 } // namespace android | 81 } // namespace android |
| 104 } // namespace chrome | 82 } // namespace chrome |
| 105 | 83 |
| 106 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_STATIC_TAB_SCENE_LAYER_
H_ | 84 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_SCENE_LAYER_TOOLBAR_SCENE_LAYER_H_ |
| OLD | NEW |