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

Unified Diff: base/android/java/src/org/chromium/base/ResourceExtractor.java

Issue 2345143002: Move language pak files to assets. (Closed)
Patch Set: Move language pak files back to assets rather than res. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: base/android/java/src/org/chromium/base/ResourceExtractor.java
diff --git a/base/android/java/src/org/chromium/base/ResourceExtractor.java b/base/android/java/src/org/chromium/base/ResourceExtractor.java
index 26db654f5a781154e68de96973942f9edd6ea9ab..2a8397a55da574335279d9744b8895a9660f11b9 100644
--- a/base/android/java/src/org/chromium/base/ResourceExtractor.java
+++ b/base/android/java/src/org/chromium/base/ResourceExtractor.java
@@ -39,17 +39,15 @@ public class ResourceExtractor {
private static ResourceEntry[] sResourcesToExtract = new ResourceEntry[0];
/**
- * Holds information about a res/raw file (e.g. locale .pak files).
+ * Holds information about an asset file (i.e. locale .pak files).
*/
public static final class ResourceEntry {
- public final int resourceId;
+ public final String fileName;
public final String pathWithinApk;
agrieve 2016/09/21 01:06:41 nit: with this unused now, we should probably just
estevenson 2016/09/21 19:50:55 Done.
- public final String extractedFileName;
- public ResourceEntry(int resourceId, String pathWithinApk, String extractedFileName) {
- this.resourceId = resourceId;
+ public ResourceEntry(String fileName, String pathWithinApk) {
+ this.fileName = fileName;
this.pathWithinApk = pathWithinApk;
- this.extractedFileName = extractedFileName;
}
}
@@ -108,15 +106,14 @@ public class ResourceExtractor {
byte[] buffer = new byte[BUFFER_SIZE];
try {
for (ResourceEntry entry : sResourcesToExtract) {
- File output = new File(outputDir, entry.extractedFileName);
+ File output = new File(outputDir, entry.fileName);
// TODO(agrieve): It would be better to check that .length == expectedLength.
// http://crbug.com/606413
if (output.length() != 0) {
continue;
}
TraceEvent.begin("ExtractResource");
- InputStream inputStream = mContext.getResources().openRawResource(
- entry.resourceId);
+ InputStream inputStream = mContext.getAssets().open(entry.fileName);
try {
extractResourceHelper(inputStream, output, buffer);
} finally {

Powered by Google App Engine
This is Rietveld 408576698