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 UpdateHeaders(JNIEnv* env, |
| 81 net::HttpResponseHeaders* headers) OVERRIDE; |
| 82 |
80 virtual ~AndroidStreamReaderURLRequestJobDelegateImpl(); | 83 virtual ~AndroidStreamReaderURLRequestJobDelegateImpl(); |
81 }; | 84 }; |
82 | 85 |
83 class AndroidProtocolHandlerBase : | 86 class AndroidProtocolHandlerBase : |
84 public net::URLRequestJobFactory::ProtocolHandler { | 87 public net::URLRequestJobFactory::ProtocolHandler { |
85 public: | 88 public: |
86 virtual net::URLRequestJob* MaybeCreateJob( | 89 virtual net::URLRequestJob* MaybeCreateJob( |
87 net::URLRequest* request, | 90 net::URLRequest* request, |
88 net::NetworkDelegate* network_delegate) const OVERRIDE; | 91 net::NetworkDelegate* network_delegate) const OVERRIDE; |
89 | 92 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 193 |
191 bool AndroidStreamReaderURLRequestJobDelegateImpl::GetCharset( | 194 bool AndroidStreamReaderURLRequestJobDelegateImpl::GetCharset( |
192 JNIEnv* env, | 195 JNIEnv* env, |
193 net::URLRequest* request, | 196 net::URLRequest* request, |
194 android_webview::InputStream* stream, | 197 android_webview::InputStream* stream, |
195 std::string* charset) { | 198 std::string* charset) { |
196 // TODO: We should probably be getting this from the managed side. | 199 // TODO: We should probably be getting this from the managed side. |
197 return false; | 200 return false; |
198 } | 201 } |
199 | 202 |
| 203 void AndroidStreamReaderURLRequestJobDelegateImpl::UpdateHeaders( |
| 204 JNIEnv* env, |
| 205 net::HttpResponseHeaders* headers) { |
| 206 // no-op |
| 207 } |
| 208 |
200 // AndroidProtocolHandlerBase ------------------------------------------------- | 209 // AndroidProtocolHandlerBase ------------------------------------------------- |
201 | 210 |
202 net::URLRequestJob* AndroidProtocolHandlerBase::MaybeCreateJob( | 211 net::URLRequestJob* AndroidProtocolHandlerBase::MaybeCreateJob( |
203 net::URLRequest* request, | 212 net::URLRequest* request, |
204 net::NetworkDelegate* network_delegate) const { | 213 net::NetworkDelegate* network_delegate) const { |
205 if (!CanHandleRequest(request)) return NULL; | 214 if (!CanHandleRequest(request)) return NULL; |
206 | 215 |
207 // For WebViewClassic compatibility this job can only accept URLs that can be | 216 // For WebViewClassic compatibility this job can only accept URLs that can be |
208 // opened. URLs that cannot be opened should be resolved by the next handler. | 217 // opened. URLs that cannot be opened should be resolved by the next handler. |
209 // | 218 // |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 env, android_webview::kAndroidAssetPath).Release(); | 316 env, android_webview::kAndroidAssetPath).Release(); |
308 } | 317 } |
309 | 318 |
310 static jstring GetAndroidResourcePath(JNIEnv* env, jclass /*clazz*/) { | 319 static jstring GetAndroidResourcePath(JNIEnv* env, jclass /*clazz*/) { |
311 // OK to release, JNI binding. | 320 // OK to release, JNI binding. |
312 return ConvertUTF8ToJavaString( | 321 return ConvertUTF8ToJavaString( |
313 env, android_webview::kAndroidResourcePath).Release(); | 322 env, android_webview::kAndroidResourcePath).Release(); |
314 } | 323 } |
315 | 324 |
316 } // namespace android_webview | 325 } // namespace android_webview |
OLD | NEW |