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 5package org.chromium.ui.base; 6 7import android.content.Context; 8import android.content.res.AssetFileDescriptor; 9import android.content.res.AssetManager; 10 11import org.chromium.base.CalledByNative; 12import org.chromium.base.JNINamespace; 13 14import java.io.IOException; 15 16/** 17 * This class provides the resource bundle related methods for the native library. 18 */ 19@JNINamespace("ui") 20class ResourceBundle { 21 @CalledByNative 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