Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 class HttpResponseHeaders; | |
| 15 class NetworkDelegate; | |
| 14 class URLRequest; | 16 class URLRequest; |
| 15 class URLRequestJob; | 17 class URLRequestJob; |
| 16 class NetworkDelegate; | |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace android_webview { | 20 namespace android_webview { |
| 20 | 21 |
| 21 class InputStream; | 22 class InputStream; |
| 22 | 23 |
| 23 // This class represents the Java-side data that is to be used to complete a | 24 // This class represents the Java-side data that is to be used to complete a |
| 24 // particular URLRequest. | 25 // particular URLRequest. |
| 25 class InterceptedRequestData { | 26 class InterceptedRequestData { |
| 26 public: | 27 public: |
| 27 virtual ~InterceptedRequestData() {} | 28 virtual ~InterceptedRequestData() {} |
| 28 | 29 |
| 29 virtual scoped_ptr<InputStream> GetInputStream(JNIEnv* env) const = 0; | 30 virtual scoped_ptr<InputStream> GetInputStream(JNIEnv* env) const = 0; |
| 30 virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const = 0; | 31 virtual bool GetMimeType(JNIEnv* env, std::string* mime_type) const = 0; |
| 31 virtual bool GetCharset(JNIEnv* env, std::string* charset) const = 0; | 32 virtual bool GetCharset(JNIEnv* env, std::string* charset) const = 0; |
| 33 virtual bool GetStatusInfo(JNIEnv* env, | |
| 34 int* status_code, | |
| 35 std::string* reason_phrase) const = 0; | |
| 36 // If true is returned then |headers| contain the headers, if false is | |
| 37 // returned |headers| were not updated. | |
| 38 virtual bool GetHeaders( | |
|
benm (inactive)
2014/05/15 17:43:15
GetResponseHeaders
mkosiba (inactive)
2014/06/19 17:54:14
Done.
| |
| 39 JNIEnv* env, | |
| 40 net::HttpResponseHeaders* headers) const = 0; | |
| 32 | 41 |
| 33 // This creates a URLRequestJob for the |request| wich will read data from | 42 // This creates a URLRequestJob for the |request| wich will read data from |
| 34 // the |intercepted_request_data| structure (instead of going to the network | 43 // the |intercepted_request_data| structure (instead of going to the network |
| 35 // or to the cache). | 44 // or to the cache). |
| 36 // The newly created job takes ownership of |intercepted_request_data|. | 45 // The newly created job takes ownership of |intercepted_request_data|. |
| 37 static net::URLRequestJob* CreateJobFor( | 46 static net::URLRequestJob* CreateJobFor( |
| 38 scoped_ptr<InterceptedRequestData> intercepted_request_data, | 47 scoped_ptr<InterceptedRequestData> intercepted_request_data, |
| 39 net::URLRequest* request, | 48 net::URLRequest* request, |
| 40 net::NetworkDelegate* network_delegate); | 49 net::NetworkDelegate* network_delegate); |
| 41 | 50 |
| 42 protected: | 51 protected: |
| 43 InterceptedRequestData() {} | 52 InterceptedRequestData() {} |
| 44 | 53 |
| 45 private: | 54 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData); | 55 DISALLOW_COPY_AND_ASSIGN(InterceptedRequestData); |
| 47 }; | 56 }; |
| 48 | 57 |
| 49 } // namespace android_webview | 58 } // namespace android_webview |
| 50 | 59 |
| 51 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ | 60 #endif // ANDROID_WEBVIEW_BROWSER_INTERCEPTED_REQUEST_DATA_H_ |
| OLD | NEW |