OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "ui/base/resource/resource_bundle.h" | |
6 | |
7 #include <string> | |
8 | |
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" | |
19 | |
20 namespace ui { | |
21 | |
22 void ResourceBundle::LoadCommonResources() { | |
23 base::FilePath path; | |
24 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path); | |
25 AddDataPackFromPath(path.AppendASCII("chrome_100_percent.pak"), | |
26 SCALE_FACTOR_100P); | |
27 } | |
28 | |
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); | |
33 } | |
34 | |
35 bool AssetContainedInApk(const std::string& filename) { | |
36 JNIEnv* env = base::android::AttachCurrentThread(); | |
37 return Java_ResourceBundle_assetContainedInApk( | |
38 env, | |
39 base::android::GetApplicationContext(), | |
40 base::android::ConvertUTF8ToJavaString(env, filename).obj()); | |
41 } | |
42 | |
43 bool RegisterResourceBundleAndroid(JNIEnv* env) { | |
44 return RegisterNativesImpl(env); | |
45 } | |
46 | |
47 } | |
OLD | NEW |