OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cronet_url_request_adapter.h" | 5 #include "cronet_url_request_adapter.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 JNIEnv* env = base::android::AttachCurrentThread(); | 250 JNIEnv* env = base::android::AttachCurrentThread(); |
251 | 251 |
252 cronet::Java_CronetUrlRequest_onRedirectReceived( | 252 cronet::Java_CronetUrlRequest_onRedirectReceived( |
253 env, owner_.obj(), | 253 env, owner_.obj(), |
254 ConvertUTF8ToJavaString(env, redirect_info.new_url.spec()).obj(), | 254 ConvertUTF8ToJavaString(env, redirect_info.new_url.spec()).obj(), |
255 redirect_info.status_code, GetResponseHeaders(env).obj(), | 255 redirect_info.status_code, GetResponseHeaders(env).obj(), |
256 request->GetTotalReceivedBytes()); | 256 request->GetTotalReceivedBytes()); |
257 *defer_redirect = true; | 257 *defer_redirect = true; |
258 } | 258 } |
259 | 259 |
| 260 void CronetURLRequestAdapter::OnCertificateRequested( |
| 261 net::URLRequest* request, |
| 262 net::SSLCertRequestInfo* cert_request_info) { |
| 263 DCHECK(context_->IsOnNetworkThread()); |
| 264 // Cronet does not support client certificates. |
| 265 request->ContinueWithCertificate(nullptr, nullptr); |
| 266 } |
| 267 |
260 void CronetURLRequestAdapter::OnSSLCertificateError( | 268 void CronetURLRequestAdapter::OnSSLCertificateError( |
261 net::URLRequest* request, | 269 net::URLRequest* request, |
262 const net::SSLInfo& ssl_info, | 270 const net::SSLInfo& ssl_info, |
263 bool fatal) { | 271 bool fatal) { |
264 DCHECK(context_->IsOnNetworkThread()); | 272 DCHECK(context_->IsOnNetworkThread()); |
265 request->Cancel(); | 273 request->Cancel(); |
266 int net_error = net::MapCertStatusToNetError(ssl_info.cert_status); | 274 int net_error = net::MapCertStatusToNetError(ssl_info.cert_status); |
267 JNIEnv* env = base::android::AttachCurrentThread(); | 275 JNIEnv* env = base::android::AttachCurrentThread(); |
268 cronet::Java_CronetUrlRequest_onError( | 276 cronet::Java_CronetUrlRequest_onError( |
269 env, owner_.obj(), net_error, | 277 env, owner_.obj(), net_error, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 << " on chromium request: " << initial_url_.possibly_invalid_spec(); | 396 << " on chromium request: " << initial_url_.possibly_invalid_spec(); |
389 JNIEnv* env = base::android::AttachCurrentThread(); | 397 JNIEnv* env = base::android::AttachCurrentThread(); |
390 cronet::Java_CronetUrlRequest_onError( | 398 cronet::Java_CronetUrlRequest_onError( |
391 env, owner_.obj(), net_error, | 399 env, owner_.obj(), net_error, |
392 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj(), | 400 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj(), |
393 request->GetTotalReceivedBytes()); | 401 request->GetTotalReceivedBytes()); |
394 return true; | 402 return true; |
395 } | 403 } |
396 | 404 |
397 } // namespace cronet | 405 } // namespace cronet |
OLD | NEW |