15f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 25f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// found in the LICENSE file. 45f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#ifndef ANDROID_WEBVIEW_NATIVE_AW_ASSETS_H_ 65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#define ANDROID_WEBVIEW_NATIVE_AW_ASSETS_H_ 75f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 85f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include <string> 95f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/android/jni_android.h" 115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace android_webview { 135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace AwAssets { 145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Called by native to retrieve an asset (e.g. a .pak file) from the apk. 165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Returns: true in case of success, false otherwise. 175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Output arguments: 185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// - |fd|: file descriptor to the apk. The caller takes the ownership. 195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// - |offset|: offset in bytes from the start of the file 205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// - |size|: size in bytes of the asset / resource. 215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)bool OpenAsset(const std::string& filename, 225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) int* fd, 235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) int64* offset, 245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) int64* size); 255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)} // namespace AwAssets 275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)bool RegisterAwAssets(JNIEnv* env); 295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)} // namsespace android_webview 315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif // ANDROID_WEBVIEW_NATIVE_AW_ASSETS_H_ 33