OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/bind.h" |
| 13 #include "base/id_map.h" |
| 14 #include "cc/resources/ui_resource_client.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 #include "ui/gfx/size.h" |
| 17 #include "ui/gfx/transform.h" |
| 18 |
| 19 namespace cc { |
| 20 class Layer; |
| 21 class UIResourceLayer; |
| 22 } |
| 23 |
| 24 namespace ui { |
| 25 class ResourceManager; |
| 26 } |
| 27 |
| 28 namespace chrome { |
| 29 namespace android { |
| 30 |
| 31 class DecorationTitle; |
| 32 |
| 33 // A native component of the Java LayerTitleCache class. This class |
| 34 // will build and maintain layers that represent the cached titles in |
| 35 // the Java class. |
| 36 class LayerTitleCache { |
| 37 public: |
| 38 static LayerTitleCache* FromJavaObject(jobject jobj); |
| 39 |
| 40 LayerTitleCache(JNIEnv* env, |
| 41 jobject jobj, |
| 42 jint fade_width, |
| 43 jint favicon_start_padding, |
| 44 jint favicon_end_padding, |
| 45 jint spinner_resource_id, |
| 46 jint spinner_incognito_resource_id); |
| 47 void Destroy(JNIEnv* env, jobject obj); |
| 48 |
| 49 // Called from Java, updates a native cc::Layer based on the new texture |
| 50 // information. |
| 51 void UpdateLayer(JNIEnv* env, |
| 52 jobject obj, |
| 53 jint tab_id, |
| 54 jint title_resource_id, |
| 55 jint favicon_resource_id, |
| 56 bool is_incognito, |
| 57 bool is_rtl); |
| 58 |
| 59 void ClearExcept(JNIEnv* env, jobject obj, jint except_id); |
| 60 |
| 61 // Returns the layer that represents the title of tab of tab_id. |
| 62 // Returns NULL if no layer can be found. |
| 63 DecorationTitle* GetTitleLayer(int tab_id); |
| 64 |
| 65 void SetResourceManager(ui::ResourceManager* resource_manager); |
| 66 |
| 67 private: |
| 68 virtual ~LayerTitleCache(); |
| 69 |
| 70 IDMap<DecorationTitle, IDMapOwnPointer> layer_cache_; |
| 71 |
| 72 JavaObjectWeakGlobalRef weak_java_title_cache_; |
| 73 int fade_width_; |
| 74 int favicon_start_padding_; |
| 75 int favicon_end_padding_; |
| 76 |
| 77 int spinner_resource_id_; |
| 78 int spinner_incognito_resource_id_; |
| 79 |
| 80 ui::ResourceManager* resource_manager_; |
| 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(LayerTitleCache); |
| 83 }; |
| 84 |
| 85 bool RegisterLayerTitleCache(JNIEnv* env); |
| 86 |
| 87 } // namespace android |
| 88 } // namespace chrome |
| 89 |
| 90 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_ |
OLD | NEW |