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 CONTENT_BROWSER_ANDROID_RESOURCE_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_RESOURCE_MANAGER_IMPL_H_ |
| 7 |
| 8 #include <android/bitmap.h> |
| 9 #include <jni.h> |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/id_map.h" |
| 12 #include "cc/resources/ui_resource_client.h" |
| 13 #include "content/public/browser/android/resource_manager.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "ui/gfx/geometry/insets_f.h" |
| 16 #include "ui/gfx/geometry/rect.h" |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class UIResourceProvider; |
| 21 |
| 22 class ResourceManagerImpl : public ResourceManager { |
| 23 public: |
| 24 static ResourceManagerImpl* FromJavaObject(jobject jobj); |
| 25 |
| 26 ResourceManagerImpl(UIResourceProvider* ui_resource_provider); |
| 27 virtual ~ResourceManagerImpl(); |
| 28 |
| 29 base::android::ScopedJavaLocalRef<jobject> GetJavaObject( |
| 30 JNIEnv* env) override; |
| 31 |
| 32 ResourceManager::Resource* GetResource(ResourceKind res_type, |
| 33 int res_id) override; |
| 34 void PreloadResource(ResourceKind res_type, int res_id) override; |
| 35 |
| 36 // Called from Java ---------------------------------------------------------- |
| 37 void OnResourceReady(JNIEnv* env, |
| 38 jobject jobj, |
| 39 jint res_type, |
| 40 jint res_id, |
| 41 jobject bitmap, |
| 42 jint padding_left, |
| 43 jint padding_top, |
| 44 jint padding_right, |
| 45 jint padding_bottom, |
| 46 jint aperture_left, |
| 47 jint aperture_top, |
| 48 jint aperture_right, |
| 49 jint aperture_bottom); |
| 50 |
| 51 static bool RegisterResourceManager(JNIEnv* env); |
| 52 |
| 53 private: |
| 54 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; |
| 55 |
| 56 content::UIResourceProvider* ui_resource_provider_; |
| 57 ResourceMap resources_[RESOURCE_KIND_COUNT]; |
| 58 |
| 59 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); |
| 62 }; |
| 63 |
| 64 } // namespace content |
| 65 |
| 66 #endif // CONTENT_BROWSER_ANDROID_RESOURCE_MANAGER_IMPL_H_ |
OLD | NEW |