1 // Copyright (c) 2012 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 #include "ui/base/resource/resource_bundle.h"
9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h"
11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h"
13 #include "base/logging.h"
14 #include "base/path_service.h"
15 #include "base/strings/stringprintf.h"
16 #include "jni/ResourceBundle_jni.h"
17 #include "ui/base/resource/resource_handle.h"
18 #include "ui/base/ui_base_paths.h"
22 void ResourceBundle::LoadCommonResources() {
24 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID
, &path
);
25 AddDataPackFromPath(path
.AppendASCII("chrome_100_percent.pak"),
29 gfx::Image
& ResourceBundle::GetNativeImageNamed(int resource_id
, ImageRTL rtl
) {
30 // Flipped image is not used on Android.
31 DCHECK_EQ(rtl
, RTL_DISABLED
);
32 return GetImageNamed(resource_id
);
35 bool AssetContainedInApk(const std::string
& filename
) {
36 JNIEnv
* env
= base::android::AttachCurrentThread();
37 return Java_ResourceBundle_assetContainedInApk(
39 base::android::GetApplicationContext(),
40 base::android::ConvertUTF8ToJavaString(env
, filename
).obj());
43 bool RegisterResourceBundleAndroid(JNIEnv
* env
) {
44 return RegisterNativesImpl(env
);