Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: base/android/apk_assets.h

Issue 1156573008: Allow OpenApkAsset() to open resource files as well as assets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « android_webview/native/aw_media_url_interceptor.cc ('k') | base/android/apk_assets.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 BASE_ANDROID_APK_ASSETS_H_ 5 #ifndef BASE_ANDROID_APK_ASSETS_H_
6 #define BASE_ANDROID_APK_ASSETS_H_ 6 #define BASE_ANDROID_APK_ASSETS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/files/memory_mapped_file.h" 11 #include "base/files/memory_mapped_file.h"
12 #include "base/posix/global_descriptors.h" 12 #include "base/posix/global_descriptors.h"
13 13
14 namespace base { 14 namespace base {
15 namespace android { 15 namespace android {
16 16
17 bool RegisterApkAssets(JNIEnv* env); 17 bool RegisterApkAssets(JNIEnv* env);
18 18
19 // Opens an asset (e.g. a .pak file) from the apk. 19 // Opens an asset (e.g. a .pak file) from the apk.
20 // Can be used from renderer process. 20 // Can be used from renderer process.
21 // Fails if the asset is not stored uncompressed within the .apk. 21 // Fails if the asset is not stored uncompressed within the .apk.
22 // Returns: The File Descriptor of the asset, or -1 upon failure. 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
23 // Output arguments: 25 // Output arguments:
24 // - |region|: size & offset (in bytes) within the .apk of the asset. 26 // - |region|: size & offset (in bytes) within the .apk of the asset.
25 BASE_EXPORT int OpenApkAsset( 27 BASE_EXPORT int OpenApkAsset(
26 const std::string& filename, 28 const std::string& file_path,
27 base::MemoryMappedFile::Region* region); 29 base::MemoryMappedFile::Region* region);
28 30
29 // Registers an uncompressed asset from within the apk with GlobalDescriptors. 31 // Registers an uncompressed asset from within the apk with GlobalDescriptors.
30 // Returns: true in case of success, false otherwise. 32 // Returns: true in case of success, false otherwise.
31 BASE_EXPORT bool RegisterApkAssetWithGlobalDescriptors( 33 BASE_EXPORT bool RegisterApkAssetWithGlobalDescriptors(
32 base::GlobalDescriptors::Key key, 34 base::GlobalDescriptors::Key key,
33 const std::string& asset_filename); 35 const std::string& file_path);
34 36
35 } // namespace android 37 } // namespace android
36 } // namespace base 38 } // namespace base
37 39
38 #endif // BASE_ANDROID_APK_ASSETS_H_ 40 #endif // BASE_ANDROID_APK_ASSETS_H_
OLDNEW
« no previous file with comments | « android_webview/native/aw_media_url_interceptor.cc ('k') | base/android/apk_assets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698