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 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { | 15 class UI_ANDROID_EXPORT ResourceManagerImpl : public ResourceManager { |
16 public: | 16 public: |
17 static ResourceManagerImpl* FromJavaObject(jobject jobj); | 17 static ResourceManagerImpl* FromJavaObject(jobject jobj); |
18 | 18 |
19 explicit ResourceManagerImpl(ui::UIResourceProvider* ui_resource_provider); | 19 ResourceManagerImpl(); |
20 ~ResourceManagerImpl() override; | 20 ~ResourceManagerImpl() override; |
21 | 21 |
| 22 void Init(cc::LayerTreeHost* host); |
| 23 |
22 // ResourceManager implementation. | 24 // ResourceManager implementation. |
23 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 25 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
24 Resource* GetResource(AndroidResourceType res_type, int res_id) override; | 26 Resource* GetResource(AndroidResourceType res_type, int res_id) override; |
25 void PreloadResource(AndroidResourceType res_type, int res_id) override; | 27 void PreloadResource(AndroidResourceType res_type, int res_id) override; |
26 | 28 |
27 // Called from Java | 29 // Called from Java |
28 // ---------------------------------------------------------- | 30 // ---------------------------------------------------------- |
29 void OnResourceReady(JNIEnv* env, | 31 void OnResourceReady(JNIEnv* env, |
30 jobject jobj, | 32 jobject jobj, |
31 jint res_type, | 33 jint res_type, |
(...skipping 14 matching lines...) Expand all Loading... |
46 friend class TestResourceManagerImpl; | 48 friend class TestResourceManagerImpl; |
47 | 49 |
48 // Start loading the resource. virtual for testing. | 50 // Start loading the resource. virtual for testing. |
49 virtual void PreloadResourceFromJava(AndroidResourceType res_type, | 51 virtual void PreloadResourceFromJava(AndroidResourceType res_type, |
50 int res_id); | 52 int res_id); |
51 virtual void RequestResourceFromJava(AndroidResourceType res_type, | 53 virtual void RequestResourceFromJava(AndroidResourceType res_type, |
52 int res_id); | 54 int res_id); |
53 | 55 |
54 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; | 56 typedef IDMap<Resource, IDMapOwnPointer> ResourceMap; |
55 | 57 |
56 ui::UIResourceProvider* const ui_resource_provider_; | 58 cc::LayerTreeHost* host_; |
57 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; | 59 ResourceMap resources_[ANDROID_RESOURCE_TYPE_COUNT]; |
58 | 60 |
59 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 61 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
60 | 62 |
61 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); | 63 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace ui | 66 } // namespace ui |
65 | 67 |
66 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ | 68 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_ |
OLD | NEW |