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 #include "android_webview/native/android_protocol_handler.h" | 5 #include "android_webview/native/android_protocol_handler.h" |
6 | 6 |
7 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" | 7 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
8 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 8 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
9 #include "android_webview/common/url_constants.h" | 9 #include "android_webview/common/url_constants.h" |
10 #include "android_webview/native/input_stream_impl.h" | 10 #include "android_webview/native/input_stream_impl.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 virtual bool GetMimeType(JNIEnv* env, | 70 virtual bool GetMimeType(JNIEnv* env, |
71 net::URLRequest* request, | 71 net::URLRequest* request, |
72 InputStream* stream, | 72 InputStream* stream, |
73 std::string* mime_type) OVERRIDE; | 73 std::string* mime_type) OVERRIDE; |
74 | 74 |
75 virtual bool GetCharset(JNIEnv* env, | 75 virtual bool GetCharset(JNIEnv* env, |
76 net::URLRequest* request, | 76 net::URLRequest* request, |
77 InputStream* stream, | 77 InputStream* stream, |
78 std::string* charset) OVERRIDE; | 78 std::string* charset) OVERRIDE; |
79 | 79 |
| 80 virtual void AppendResponseHeaders( |
| 81 JNIEnv* env, |
| 82 net::HttpResponseHeaders* headers) OVERRIDE; |
| 83 |
80 virtual ~AndroidStreamReaderURLRequestJobDelegateImpl(); | 84 virtual ~AndroidStreamReaderURLRequestJobDelegateImpl(); |
81 }; | 85 }; |
82 | 86 |
83 class AndroidRequestInterceptorBase : public net::URLRequestInterceptor { | 87 class AndroidRequestInterceptorBase : public net::URLRequestInterceptor { |
84 public: | 88 public: |
85 virtual net::URLRequestJob* MaybeInterceptRequest( | 89 virtual net::URLRequestJob* MaybeInterceptRequest( |
86 net::URLRequest* request, | 90 net::URLRequest* request, |
87 net::NetworkDelegate* network_delegate) const OVERRIDE; | 91 net::NetworkDelegate* network_delegate) const OVERRIDE; |
88 | 92 |
89 virtual bool ShouldHandleRequest(const net::URLRequest* request) const = 0; | 93 virtual bool ShouldHandleRequest(const net::URLRequest* request) const = 0; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 195 |
192 bool AndroidStreamReaderURLRequestJobDelegateImpl::GetCharset( | 196 bool AndroidStreamReaderURLRequestJobDelegateImpl::GetCharset( |
193 JNIEnv* env, | 197 JNIEnv* env, |
194 net::URLRequest* request, | 198 net::URLRequest* request, |
195 android_webview::InputStream* stream, | 199 android_webview::InputStream* stream, |
196 std::string* charset) { | 200 std::string* charset) { |
197 // TODO: We should probably be getting this from the managed side. | 201 // TODO: We should probably be getting this from the managed side. |
198 return false; | 202 return false; |
199 } | 203 } |
200 | 204 |
| 205 void AndroidStreamReaderURLRequestJobDelegateImpl::AppendResponseHeaders( |
| 206 JNIEnv* env, |
| 207 net::HttpResponseHeaders* headers) { |
| 208 // no-op |
| 209 } |
| 210 |
201 // AndroidRequestInterceptorBase ---------------------------------------------- | 211 // AndroidRequestInterceptorBase ---------------------------------------------- |
202 | 212 |
203 net::URLRequestJob* AndroidRequestInterceptorBase::MaybeInterceptRequest( | 213 net::URLRequestJob* AndroidRequestInterceptorBase::MaybeInterceptRequest( |
204 net::URLRequest* request, | 214 net::URLRequest* request, |
205 net::NetworkDelegate* network_delegate) const { | 215 net::NetworkDelegate* network_delegate) const { |
206 if (!ShouldHandleRequest(request)) | 216 if (!ShouldHandleRequest(request)) |
207 return NULL; | 217 return NULL; |
208 | 218 |
209 // For WebViewClassic compatibility this job can only accept URLs that can be | 219 // For WebViewClassic compatibility this job can only accept URLs that can be |
210 // opened. URLs that cannot be opened should be resolved by the next handler. | 220 // opened. URLs that cannot be opened should be resolved by the next handler. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 env, android_webview::kAndroidAssetPath).Release(); | 319 env, android_webview::kAndroidAssetPath).Release(); |
310 } | 320 } |
311 | 321 |
312 static jstring GetAndroidResourcePath(JNIEnv* env, jclass /*clazz*/) { | 322 static jstring GetAndroidResourcePath(JNIEnv* env, jclass /*clazz*/) { |
313 // OK to release, JNI binding. | 323 // OK to release, JNI binding. |
314 return ConvertUTF8ToJavaString( | 324 return ConvertUTF8ToJavaString( |
315 env, android_webview::kAndroidResourcePath).Release(); | 325 env, android_webview::kAndroidResourcePath).Release(); |
316 } | 326 } |
317 | 327 |
318 } // namespace android_webview | 328 } // namespace android_webview |
OLD | NEW |