OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/base/resource/resource_bundle_android.h" | 5 #include "ui/base/resource/resource_bundle_android.h" |
6 | 6 |
7 #include "base/android/apk_assets.h" | 7 #include "base/android/apk_assets.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 42 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
43 // Flipped image is not used on Android. | 43 // Flipped image is not used on Android. |
44 DCHECK_EQ(rtl, RTL_DISABLED); | 44 DCHECK_EQ(rtl, RTL_DISABLED); |
45 return GetImageNamed(resource_id); | 45 return GetImageNamed(resource_id); |
46 } | 46 } |
47 | 47 |
48 void SetLocalePaksStoredInApk(bool value) { | 48 void SetLocalePaksStoredInApk(bool value) { |
49 g_locale_paks_in_apk = value; | 49 g_locale_paks_in_apk = value; |
50 } | 50 } |
51 | 51 |
| 52 bool GetLocalePaksStoredInApk() { |
| 53 return g_locale_paks_in_apk; |
| 54 } |
| 55 |
52 void LoadMainAndroidPackFile() { | 56 void LoadMainAndroidPackFile() { |
53 DCHECK_EQ(g_resources_pack_fd, -1); | 57 DCHECK_EQ(g_resources_pack_fd, -1); |
54 g_resources_pack_fd = base::android::OpenApkAsset("assets/resources.pak", | 58 g_resources_pack_fd = base::android::OpenApkAsset("assets/resources.pak", |
55 &g_resources_pack_region); | 59 &g_resources_pack_region); |
56 DCHECK_GE(g_resources_pack_fd, 0); | 60 DCHECK_GE(g_resources_pack_fd, 0); |
57 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( | 61 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( |
58 base::File(g_resources_pack_fd), g_resources_pack_region, | 62 base::File(g_resources_pack_fd), g_resources_pack_region, |
59 SCALE_FACTOR_NONE); | 63 SCALE_FACTOR_NONE); |
60 } | 64 } |
61 | 65 |
(...skipping 18 matching lines...) Expand all Loading... |
80 return std::string(); | 84 return std::string(); |
81 } | 85 } |
82 return base::android::ConvertJavaStringToUTF8(env, ret.obj()); | 86 return base::android::ConvertJavaStringToUTF8(env, ret.obj()); |
83 } | 87 } |
84 | 88 |
85 bool RegisterResourceBundleAndroid(JNIEnv* env) { | 89 bool RegisterResourceBundleAndroid(JNIEnv* env) { |
86 return RegisterNativesImpl(env); | 90 return RegisterNativesImpl(env); |
87 } | 91 } |
88 | 92 |
89 } | 93 } |
OLD | NEW |