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

Side by Side Diff: ui/base/resource/resource_bundle_android.h

Issue 1187433006: Load language .pak files directly from the apk when using splits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@locale-res-or-file
Patch Set: Fix ui_base_unittest failure (allow locale paks to be loaded multiple times) Created 5 years, 5 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 | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_android.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 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/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/files/memory_mapped_file.h" 12 #include "base/files/memory_mapped_file.h"
13 #include "ui/base/ui_base_export.h" 13 #include "ui/base/ui_base_export.h"
14 14
15 namespace ui { 15 namespace ui {
16 16
17 // Loads "resources.apk" from the .apk. Falls back to loading from disk, which 17 // Loads "resources.apk" from the .apk. Falls back to loading from disk, which
18 // is necessary for tests. 18 // is necessary for tests.
19 UI_BASE_EXPORT void LoadMainAndroidPackFile( 19 UI_BASE_EXPORT void LoadMainAndroidPackFile(
20 const char* path_within_apk, 20 const char* path_within_apk,
21 const base::FilePath& disk_file_path); 21 const base::FilePath& disk_file_path);
22 22
23 // Returns the file descriptor and region for resources.pak. 23 // Returns the file descriptor and region for resources.pak.
24 UI_BASE_EXPORT int GetMainAndroidPackFd( 24 UI_BASE_EXPORT int GetMainAndroidPackFd(
25 base::MemoryMappedFile::Region* out_region); 25 base::MemoryMappedFile::Region* out_region);
26 26
27 // Returns the file descriptor and region for chrome_100_percent.pak 27 // Returns the file descriptor and region for chrome_100_percent.pak.
28 UI_BASE_EXPORT int GetCommonResourcesPackFd( 28 UI_BASE_EXPORT int GetCommonResourcesPackFd(
29 base::MemoryMappedFile::Region* out_region); 29 base::MemoryMappedFile::Region* out_region);
30 30
31 // Returns the file descriptor and region for the locale .pak file.
32 UI_BASE_EXPORT int GetLocalePackFd(
33 base::MemoryMappedFile::Region* out_region);
34
31 // Tell ResourceBundle to locate locale pak files via 35 // Tell ResourceBundle to locate locale pak files via
32 // GetPathForAndroidLocalePakWithinApk rather than looking for them on disk. 36 // GetPathForAndroidLocalePakWithinApk rather than looking for them on disk.
33 UI_BASE_EXPORT void SetLocalePaksStoredInApk(bool value); 37 UI_BASE_EXPORT void SetLocalePaksStoredInApk(bool value);
34 38
35 // Returns the path within the apk for the given locale's .pak file, or an 39 // Returns the path within the apk for the given locale's .pak file, or an
36 // empty string if it doesn't exist. 40 // empty string if it doesn't exist.
37 // Only locale paks for the active Android language can be retrieved. 41 // Only locale paks for the active Android language can be retrieved.
38 UI_BASE_EXPORT std::string GetPathForAndroidLocalePakWithinApk( 42 UI_BASE_EXPORT std::string GetPathForAndroidLocalePakWithinApk(
39 const std::string& locale); 43 const std::string& locale);
40 44
41 bool RegisterResourceBundleAndroid(JNIEnv* env); 45 bool RegisterResourceBundleAndroid(JNIEnv* env);
42 46
43 } // namespace ui 47 } // namespace ui
44 48
45 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_ 49 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_ANDROID_H_
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/base/resource/resource_bundle_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698