| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 5 #ifndef UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
| 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "ui/android/resources/resource_manager.h" | 9 #include "ui/android/resources/resource_manager.h" |
| 10 #include "ui/android/ui_android_export.h" | 10 #include "ui/android/ui_android_export.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/native_widget_types.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { | 16 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { |
| 16 public: | 17 public: |
| 17 static ResourceManagerImpl* FromJavaObject(jobject jobj); | 18 static ResourceManagerImpl* FromJavaObject(jobject jobj); |
| 18 | 19 |
| 19 ResourceManagerImpl(); | 20 explicit ResourceManagerImpl(gfx::NativeWindow native_window); |
| 20 ~ResourceManagerImpl() override; | 21 ~ResourceManagerImpl() override; |
| 21 | 22 |
| 22 void Init(cc::LayerTreeHost* host); | 23 void Init(cc::LayerTreeHost* host); |
| 23 | 24 |
| 24 // ResourceManager implementation. | 25 // ResourceManager implementation. |
| 25 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 26 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
| 26 Resource* GetResource(AndroidResourceType res_type, int res_id) override; | 27 Resource* GetResource(AndroidResourceType res_type, int res_id) override; |
| 27 void PreloadResource(AndroidResourceType res_type, int res_id) override; | 28 void PreloadResource(AndroidResourceType res_type, int res_id) override; |
| 28 | 29 |
| 29 // Called from Java | 30 // Called from Java |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 jint aperture_left, | 41 jint aperture_left, |
| 41 jint aperture_top, | 42 jint aperture_top, |
| 42 jint aperture_right, | 43 jint aperture_right, |
| 43 jint aperture_bottom); | 44 jint aperture_bottom); |
| 44 | 45 |
| 45 static bool RegisterResourceManager(JNIEnv* env); | 46 static bool RegisterResourceManager(JNIEnv* env); |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 friend class TestResourceManagerImpl; | 49 friend class TestResourceManagerImpl; |
| 49 | 50 |
| 51 // Only for testing |
| 52 // TODO(gsennton) remove this by adding functionality to create a NativeWindow |
| 53 // from a Context (and pass that NativeWindow to the public ctor) |
| 54 explicit ResourceManagerImpl(jobject context); |
| 55 |
| 50 // Start loading the resource. virtual for testing. | 56 // Start loading the resource. virtual for testing. |
| 51 virtual void PreloadResourceFromJava(AndroidResourceType res_type, | 57 virtual void PreloadResourceFromJava(AndroidResourceType res_type, |
| 52 int res_id); | 58 int res_id); |
| 53 virtual void RequestResourceFromJava(AndroidResourceType res_type, | 59 virtual void RequestResourceFromJava(AndroidResourceType res_type, |
| 54 int res_id); | 60 int res_id); |
| 55 | 61 |
| 56 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; | 62 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; |
| 57 | 63 |
| 58 cc::LayerTreeHost* host_; | 64 cc::LayerTreeHost* host_; |
| 59 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; | 65 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; |
| 60 | 66 |
| 61 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 67 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 62 | 68 |
| 63 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); | 69 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); |
| 64 }; | 70 }; |
| 65 | 71 |
| 66 } // namespace ui | 72 } // namespace ui |
| 67 | 73 |
| 68 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 74 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
| OLD | NEW |