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 <utility> |
| 8 |
7 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" | 9 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
8 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
9 #include "android_webview/common/url_constants.h" | 11 #include "android_webview/common/url_constants.h" |
10 #include "android_webview/native/input_stream_impl.h" | 12 #include "android_webview/native/input_stream_impl.h" |
11 #include "base/android/context_utils.h" | 13 #include "base/android/context_utils.h" |
12 #include "base/android/jni_android.h" | 14 #include "base/android/jni_android.h" |
13 #include "base/android/jni_string.h" | 15 #include "base/android/jni_string.h" |
14 #include "base/android/jni_weak_ref.h" | 16 #include "base/android/jni_weak_ref.h" |
15 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
16 #include "jni/AndroidProtocolHandler_jni.h" | 18 #include "jni/AndroidProtocolHandler_jni.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // Restarting a request involves creating a new job for that request. This | 217 // Restarting a request involves creating a new job for that request. This |
216 // handler will ignore requests know to have previously failed to 1) prevent | 218 // handler will ignore requests know to have previously failed to 1) prevent |
217 // an infinite loop, 2) ensure that the next handler in line gets the | 219 // an infinite loop, 2) ensure that the next handler in line gets the |
218 // opportunity to create a job for the request. | 220 // opportunity to create a job for the request. |
219 if (HasRequestPreviouslyFailed(request)) | 221 if (HasRequestPreviouslyFailed(request)) |
220 return NULL; | 222 return NULL; |
221 | 223 |
222 scoped_ptr<AndroidStreamReaderURLRequestJobDelegateImpl> reader_delegate( | 224 scoped_ptr<AndroidStreamReaderURLRequestJobDelegateImpl> reader_delegate( |
223 new AndroidStreamReaderURLRequestJobDelegateImpl()); | 225 new AndroidStreamReaderURLRequestJobDelegateImpl()); |
224 | 226 |
225 return new AndroidStreamReaderURLRequestJob( | 227 return new AndroidStreamReaderURLRequestJob(request, network_delegate, |
226 request, network_delegate, reader_delegate.Pass()); | 228 std::move(reader_delegate)); |
227 } | 229 } |
228 | 230 |
229 // AssetFileRequestInterceptor ------------------------------------------------ | 231 // AssetFileRequestInterceptor ------------------------------------------------ |
230 | 232 |
231 AssetFileRequestInterceptor::AssetFileRequestInterceptor() { | 233 AssetFileRequestInterceptor::AssetFileRequestInterceptor() { |
232 } | 234 } |
233 | 235 |
234 bool AssetFileRequestInterceptor::ShouldHandleRequest( | 236 bool AssetFileRequestInterceptor::ShouldHandleRequest( |
235 const net::URLRequest* request) const { | 237 const net::URLRequest* request) const { |
236 return android_webview::IsAndroidSpecialFileUrl(request->url()); | 238 return android_webview::IsAndroidSpecialFileUrl(request->url()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); | 292 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); |
291 } | 293 } |
292 | 294 |
293 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( | 295 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( |
294 JNIEnv* env, | 296 JNIEnv* env, |
295 const JavaParamRef<jclass>& /*clazz*/) { | 297 const JavaParamRef<jclass>& /*clazz*/) { |
296 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); | 298 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); |
297 } | 299 } |
298 | 300 |
299 } // namespace android_webview | 301 } // namespace android_webview |
OLD | NEW |