| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #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" |
| 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ScopedJavaLocalRef<jstring> jurl = | 134 ScopedJavaLocalRef<jstring> jurl = |
| 135 ConvertUTF8ToJavaString(env, url.spec()); | 135 ConvertUTF8ToJavaString(env, url.spec()); |
| 136 ScopedJavaLocalRef<jobject> stream = | 136 ScopedJavaLocalRef<jobject> stream = |
| 137 android_webview::Java_AndroidProtocolHandler_open( | 137 android_webview::Java_AndroidProtocolHandler_open( |
| 138 env, GetResourceContext(env), jurl); | 138 env, GetResourceContext(env), jurl); |
| 139 | 139 |
| 140 if (stream.is_null()) { | 140 if (stream.is_null()) { |
| 141 DLOG(ERROR) << "Unable to open input stream for Android URL"; | 141 DLOG(ERROR) << "Unable to open input stream for Android URL"; |
| 142 return std::unique_ptr<InputStream>(); | 142 return std::unique_ptr<InputStream>(); |
| 143 } | 143 } |
| 144 return base::WrapUnique(new InputStreamImpl(stream)); | 144 return base::MakeUnique<InputStreamImpl>(stream); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void AndroidStreamReaderURLRequestJobDelegateImpl::OnInputStreamOpenFailed( | 147 void AndroidStreamReaderURLRequestJobDelegateImpl::OnInputStreamOpenFailed( |
| 148 net::URLRequest* request, | 148 net::URLRequest* request, |
| 149 bool* restart) { | 149 bool* restart) { |
| 150 DCHECK(!HasRequestPreviouslyFailed(request)); | 150 DCHECK(!HasRequestPreviouslyFailed(request)); |
| 151 MarkRequestAsFailed(request); | 151 MarkRequestAsFailed(request); |
| 152 *restart = true; | 152 *restart = true; |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 namespace android_webview { | 245 namespace android_webview { |
| 246 | 246 |
| 247 bool RegisterAndroidProtocolHandler(JNIEnv* env) { | 247 bool RegisterAndroidProtocolHandler(JNIEnv* env) { |
| 248 return RegisterNativesImpl(env); | 248 return RegisterNativesImpl(env); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // static | 251 // static |
| 252 std::unique_ptr<net::URLRequestInterceptor> | 252 std::unique_ptr<net::URLRequestInterceptor> |
| 253 CreateContentSchemeRequestInterceptor() { | 253 CreateContentSchemeRequestInterceptor() { |
| 254 return base::WrapUnique(new ContentSchemeRequestInterceptor()); | 254 return base::MakeUnique<ContentSchemeRequestInterceptor>(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 // static | 257 // static |
| 258 std::unique_ptr<net::URLRequestInterceptor> | 258 std::unique_ptr<net::URLRequestInterceptor> |
| 259 CreateAssetFileRequestInterceptor() { | 259 CreateAssetFileRequestInterceptor() { |
| 260 return std::unique_ptr<net::URLRequestInterceptor>( | 260 return std::unique_ptr<net::URLRequestInterceptor>( |
| 261 new AssetFileRequestInterceptor()); | 261 new AssetFileRequestInterceptor()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 // Set a context object to be used for resolving resource queries. This can | 264 // Set a context object to be used for resolving resource queries. This can |
| (...skipping 19 matching lines...) Expand all Loading... |
| 284 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); | 284 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); |
| 285 } | 285 } |
| 286 | 286 |
| 287 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( | 287 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( |
| 288 JNIEnv* env, | 288 JNIEnv* env, |
| 289 const JavaParamRef<jclass>& /*clazz*/) { | 289 const JavaParamRef<jclass>& /*clazz*/) { |
| 290 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); | 290 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace android_webview | 293 } // namespace android_webview |
| OLD | NEW |