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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 base::android::ScopedJavaLocalRef<jstring> | 221 base::android::ScopedJavaLocalRef<jstring> |
222 CronetURLRequestAdapter::GetNegotiatedProtocol(JNIEnv* env, | 222 CronetURLRequestAdapter::GetNegotiatedProtocol(JNIEnv* env, |
223 jobject jcaller) const { | 223 jobject jcaller) const { |
224 DCHECK(context_->IsOnNetworkThread()); | 224 DCHECK(context_->IsOnNetworkThread()); |
225 return ConvertUTF8ToJavaString( | 225 return ConvertUTF8ToJavaString( |
226 env, url_request_->response_info().npn_negotiated_protocol); | 226 env, url_request_->response_info().npn_negotiated_protocol); |
227 } | 227 } |
228 | 228 |
| 229 base::android::ScopedJavaLocalRef<jstring> |
| 230 CronetURLRequestAdapter::GetProxyServer(JNIEnv* env, |
| 231 jobject jcaller) const { |
| 232 DCHECK(context_->IsOnNetworkThread()); |
| 233 return ConvertUTF8ToJavaString( |
| 234 env, url_request_->response_info().proxy_server.ToString()); |
| 235 } |
| 236 |
229 jboolean CronetURLRequestAdapter::GetWasCached(JNIEnv* env, | 237 jboolean CronetURLRequestAdapter::GetWasCached(JNIEnv* env, |
230 jobject jcaller) const { | 238 jobject jcaller) const { |
231 DCHECK(context_->IsOnNetworkThread()); | 239 DCHECK(context_->IsOnNetworkThread()); |
232 return url_request_->response_info().was_cached; | 240 return url_request_->response_info().was_cached; |
233 } | 241 } |
234 | 242 |
235 // net::URLRequest::Delegate overrides (called on network thread). | 243 // net::URLRequest::Delegate overrides (called on network thread). |
236 | 244 |
237 void CronetURLRequestAdapter::OnReceivedRedirect( | 245 void CronetURLRequestAdapter::OnReceivedRedirect( |
238 net::URLRequest* request, | 246 net::URLRequest* request, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 VLOG(1) << "Error " << net::ErrorToString(net_error) | 338 VLOG(1) << "Error " << net::ErrorToString(net_error) |
331 << " on chromium request: " << initial_url_.possibly_invalid_spec(); | 339 << " on chromium request: " << initial_url_.possibly_invalid_spec(); |
332 JNIEnv* env = base::android::AttachCurrentThread(); | 340 JNIEnv* env = base::android::AttachCurrentThread(); |
333 cronet::Java_CronetUrlRequest_onError( | 341 cronet::Java_CronetUrlRequest_onError( |
334 env, owner_.obj(), net_error, | 342 env, owner_.obj(), net_error, |
335 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj()); | 343 ConvertUTF8ToJavaString(env, net::ErrorToString(net_error)).obj()); |
336 return true; | 344 return true; |
337 } | 345 } |
338 | 346 |
339 } // namespace cronet | 347 } // namespace cronet |
OLD | NEW |