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