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 UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
6 #define UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_
8 #include "base/id_map.h"
9 #include "ui/android/resources/resource_manager.h"
10 #include "ui/android/ui_android_export.h"
11 #include "ui/gfx/geometry/rect.h"
15 class UI_ANDROID_EXPORT ResourceManagerImpl
: public ResourceManager
{
17 static ResourceManagerImpl
* FromJavaObject(jobject jobj
);
19 explicit ResourceManagerImpl(ui::UIResourceProvider
* ui_resource_provider
);
20 ~ResourceManagerImpl() override
;
22 // ResourceManager implementation.
23 base::android::ScopedJavaLocalRef
<jobject
> GetJavaObject() override
;
24 Resource
* GetResource(AndroidResourceType res_type
, int res_id
) override
;
25 void PreloadResource(AndroidResourceType res_type
, int res_id
) override
;
28 // ----------------------------------------------------------
29 void OnResourceReady(JNIEnv
* env
,
41 jint aperture_bottom
);
43 static bool RegisterResourceManager(JNIEnv
* env
);
46 friend class TestResourceManagerImpl
;
48 // Start loading the resource. virtual for testing.
49 virtual void PreloadResourceFromJava(AndroidResourceType res_type
,
51 virtual void RequestResourceFromJava(AndroidResourceType res_type
,
54 typedef IDMap
<Resource
, IDMapOwnPointer
> ResourceMap
;
56 ui::UIResourceProvider
* const ui_resource_provider_
;
57 ResourceMap resources_
[ANDROID_RESOURCE_TYPE_COUNT
];
59 base::android::ScopedJavaGlobalRef
<jobject
> java_obj_
;
61 DISALLOW_COPY_AND_ASSIGN(ResourceManagerImpl
);
66 #endif // UI_ANDROID_RESOURCES_RESOURCE_MANAGER_IMPL_H_