Remove use of JSONReader::DeprecatedRead from activity_log
[chromium-blink-merge.git] / base / android / apk_assets.h
blob6eb5da37354069dbf50f982fc17c26f61c1de7ae
1 // Copyright 2015 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 BASE_ANDROID_APK_ASSETS_H_
6 #define BASE_ANDROID_APK_ASSETS_H_
8 #include <string>
10 #include "base/android/jni_android.h"
11 #include "base/files/memory_mapped_file.h"
12 #include "base/posix/global_descriptors.h"
14 namespace base {
15 namespace android {
17 bool RegisterApkAssets(JNIEnv* env);
19 // Opens an asset (e.g. a .pak file) from the apk.
20 // Can be used from renderer process.
21 // Fails if the asset is not stored uncompressed within the .apk.
22 // Returns: The File Descriptor of the asset, or -1 upon failure.
23 // Input arguments:
24 // - |file_path|: Path to file within .apk. e.g.: assets/foo.pak
25 // Output arguments:
26 // - |region|: size & offset (in bytes) within the .apk of the asset.
27 BASE_EXPORT int OpenApkAsset(
28 const std::string& file_path,
29 base::MemoryMappedFile::Region* region);
31 // Registers an uncompressed asset from within the apk with GlobalDescriptors.
32 // Returns: true in case of success, false otherwise.
33 BASE_EXPORT bool RegisterApkAssetWithGlobalDescriptors(
34 base::GlobalDescriptors::Key key,
35 const std::string& file_path);
37 } // namespace android
38 } // namespace base
40 #endif // BASE_ANDROID_APK_ASSETS_H_