Fix build for use_aura=0
[chromium-blink-merge.git] / android_webview / browser / intercepted_request_data.h
blobacf031d338c788eef6583ccd393d90aaf6779a31
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_
8 #include <string>
10 #include "base/android/jni_android.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace net {
14 class URLRequest;
15 class URLRequestJob;
16 class NetworkDelegate;
19 namespace android_webview {
21 class InputStream;
23 // This class represents the Java-side data that is to be used to complete a
24 // particular URLRequest.
25 class InterceptedRequestData {
26 public:
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
35 // or to the cache).
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);
42 protected:
43 InterceptedRequestData() {}
45 private:
46 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData);
49 } // namespace android_webview
51 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_