• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 package org.chromium.ui.base;
6 
7 import android.content.Context;
8 import android.content.res.AssetFileDescriptor;
9 import android.content.res.AssetManager;
10 
11 import org.chromium.base.CalledByNative;
12 import org.chromium.base.JNINamespace;
13 
14 import java.io.IOException;
15 
16 /**
17  * This class provides the resource bundle related methods for the native library.
18  */
19 @JNINamespace("ui")
20 class ResourceBundle {
21     @CalledByNative
assetContainedInApk(Context ctx, String filename)22     static boolean assetContainedInApk(Context ctx, String filename) {
23         try {
24             AssetManager am = ctx.getAssets();
25             AssetFileDescriptor afd = am.openFd(filename);
26             afd.close();
27             return true;
28         } catch (IOException e) {
29             return false;
30         }
31     }
32 }
33