1 // Copyright (c) 2012 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.
5 #ifndef ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_
6 #define ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_
10 #include "base/android/jni_android.h"
11 #include "base/memory/scoped_ptr.h"
16 class NetworkDelegate
;
19 namespace android_webview
{
23 // This class represents the Java-side data that is to be used to complete a
24 // particular URLRequest.
25 class InterceptedRequestData
{
27 virtual ~InterceptedRequestData() {}
29 virtual scoped_ptr
<InputStream
> GetInputStream(JNIEnv
* env
) const = 0;
30 virtual bool GetMimeType(JNIEnv
* env
, std::string
* mime_type
) const = 0;
31 virtual bool GetCharset(JNIEnv
* env
, std::string
* charset
) const = 0;
33 // This creates a URLRequestJob for the |request| wich will read data from
34 // the |intercepted_request_data| structure (instead of going to the network
36 // The newly created job takes ownership of |intercepted_request_data|.
37 static net::URLRequestJob
* CreateJobFor(
38 scoped_ptr
<InterceptedRequestData
> intercepted_request_data
,
39 net::URLRequest
* request
,
40 net::NetworkDelegate
* network_delegate
);
43 InterceptedRequestData() {}
46 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData
);
49 } // namespace android_webview
51 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_