Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / android / compositor / layer_title_cache.h
blob14c150de953d8839cca38e6cd4b7e0de2de2c0ae
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.
5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_
8 #include <jni.h>
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/geometry/size.h"
17 #include "ui/gfx/transform.h"
19 namespace cc {
20 class Layer;
21 class UIResourceLayer;
24 namespace ui {
25 class ResourceManager;
28 namespace chrome {
29 namespace android {
31 class DecorationTitle;
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);
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);
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);
59 void ClearExcept(JNIEnv* env, jobject obj, jint except_id);
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);
65 void SetResourceManager(ui::ResourceManager* resource_manager);
67 private:
68 virtual ~LayerTitleCache();
70 IDMap<DecorationTitle, IDMapOwnPointer> layer_cache_;
72 JavaObjectWeakGlobalRef weak_java_title_cache_;
73 int fade_width_;
74 int favicon_start_padding_;
75 int favicon_end_padding_;
77 int spinner_resource_id_;
78 int spinner_incognito_resource_id_;
80 ui::ResourceManager* resource_manager_;
82 DISALLOW_COPY_AND_ASSIGN(LayerTitleCache);
85 bool RegisterLayerTitleCache(JNIEnv* env);
87 } // namespace android
88 } // namespace chrome
90 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_TITLE_CACHE_H_