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_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ | 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ |
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ | 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/memory_mapped_file.h" | 11 #include "base/files/memory_mapped_file.h" |
12 #include "ui/base/ui_base_export.h" | 12 #include "ui/base/ui_base_export.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 // Loads "resources.apk" from the .apk. Falls back to loading from disk, which | 16 // Loads "resources.apk" from the .apk. Falls back to loading from disk, which |
17 // is necessary for tests. | 17 // is necessary for tests. Returns true if it succeeds, false otherwise. |
18 UI_BASE_EXPORT void LoadMainAndroidPackFile( | 18 UI_BASE_EXPORT bool LoadMainAndroidPackFile( |
19 const char* path_within_apk, | 19 const char* path_within_apk, |
20 const base::FilePath& disk_file_path); | 20 const base::FilePath& disk_file_path); |
21 | 21 |
22 // Returns the file descriptor and region for resources.pak. | 22 // Returns the file descriptor and region for resources.pak. |
23 UI_BASE_EXPORT int GetMainAndroidPackFd( | 23 UI_BASE_EXPORT int GetMainAndroidPackFd( |
24 base::MemoryMappedFile::Region* out_region); | 24 base::MemoryMappedFile::Region* out_region); |
25 | 25 |
26 // Returns the file descriptor and region for chrome_100_percent.pak. | 26 // Returns the file descriptor and region for chrome_100_percent.pak. |
27 UI_BASE_EXPORT int GetCommonResourcesPackFd( | 27 UI_BASE_EXPORT int GetCommonResourcesPackFd( |
28 base::MemoryMappedFile::Region* out_region); | 28 base::MemoryMappedFile::Region* out_region); |
29 | 29 |
30 // Returns the file descriptor and region for the locale .pak file. | 30 // Returns the file descriptor and region for the locale .pak file. |
31 UI_BASE_EXPORT int GetLocalePackFd( | 31 UI_BASE_EXPORT int GetLocalePackFd( |
32 base::MemoryMappedFile::Region* out_region); | 32 base::MemoryMappedFile::Region* out_region); |
33 | 33 |
34 // Tell ResourceBundle to locate locale pak files via | 34 // Tell ResourceBundle to locate locale pak files via |
35 // GetPathForAndroidLocalePakWithinApk rather than looking for them on disk. | 35 // GetPathForAndroidLocalePakWithinApk rather than looking for them on disk. |
36 UI_BASE_EXPORT void SetLocalePaksStoredInApk(bool value); | 36 UI_BASE_EXPORT void SetLocalePaksStoredInApk(bool value); |
37 | 37 |
38 // Returns the path within the apk for the given locale's .pak file, or an | 38 // Returns the path within the apk for the given locale's .pak file, or an |
39 // empty string if it doesn't exist. | 39 // empty string if it doesn't exist. |
40 // Only locale paks for the active Android language can be retrieved. | 40 // Only locale paks for the active Android language can be retrieved. |
41 UI_BASE_EXPORT std::string GetPathForAndroidLocalePakWithinApk( | 41 UI_BASE_EXPORT std::string GetPathForAndroidLocalePakWithinApk( |
42 const std::string& locale); | 42 const std::string& locale); |
43 | 43 |
44 } // namespace ui | 44 } // namespace ui |
45 | 45 |
46 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ | 46 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ |
OLD | NEW |