blob: 2587d5aca8653599fd7be461df27b0ed5e95a78f [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_ANDROID_PROTOCOL_HANDLER_H_
#define ANDROID_WEBVIEW_BROWSER_ANDROID_PROTOCOL_HANDLER_H_
#include <jni.h>
#include <memory>
class GURL;
namespace net {
class URLRequestInterceptor;
} // namespace net
namespace android_webview {
class InputStream;
// These methods create interceptors for Android WebView-specific schemes:
//
// - "content:" scheme is used for accessing data from Android content
// providers, see http://developer.android.com/guide/topics/providers/
// content-provider-basics.html#ContentURIs
std::unique_ptr<net::URLRequestInterceptor>
CreateContentSchemeRequestInterceptor();
// - "file:" scheme extension for accessing application assets and resources
// (file:///android_asset/ and file:///android_res/), see
// http://developer.android.com/reference/android/webkit/
// WebSettings.html#setAllowFileAccess(boolean)
std::unique_ptr<net::URLRequestInterceptor> CreateAssetFileRequestInterceptor();
std::unique_ptr<InputStream> CreateInputStream(JNIEnv* env, const GURL& url);
bool GetInputStreamMimeType(JNIEnv* env,
const GURL& url,
InputStream* stream,
std::string* mime_type);
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_ANDROID_PROTOCOL_HANDLER_H_