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 "components/cronet/android/chromium_url_request.h" | 5 #include "components/cronet/android/chromium_url_request.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/cronet/android/url_request_adapter.h" | 10 #include "components/cronet/android/url_request_adapter.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 jobject jcaller, | 393 jobject jcaller, |
394 jlong jurl_request_adapter) { | 394 jlong jurl_request_adapter) { |
395 URLRequestAdapter* request_adapter = | 395 URLRequestAdapter* request_adapter = |
396 reinterpret_cast<URLRequestAdapter*>(jurl_request_adapter); | 396 reinterpret_cast<URLRequestAdapter*>(jurl_request_adapter); |
397 DCHECK(request_adapter); | 397 DCHECK(request_adapter); |
398 | 398 |
399 std::string negotiated_protocol = request_adapter->GetNegotiatedProtocol(); | 399 std::string negotiated_protocol = request_adapter->GetNegotiatedProtocol(); |
400 return ConvertUTF8ToJavaString(env, negotiated_protocol.c_str()).Release(); | 400 return ConvertUTF8ToJavaString(env, negotiated_protocol.c_str()).Release(); |
401 } | 401 } |
402 | 402 |
| 403 static jboolean GetWasCached(JNIEnv* env, |
| 404 jobject jcaller, |
| 405 jlong jurl_request_adapter) { |
| 406 URLRequestAdapter* request_adapter = |
| 407 reinterpret_cast<URLRequestAdapter*>(jurl_request_adapter); |
| 408 DCHECK(request_adapter); |
| 409 |
| 410 bool was_cached = request_adapter->GetWasCached(); |
| 411 return was_cached ? JNI_TRUE : JNI_FALSE; |
| 412 } |
| 413 |
403 static void DisableRedirects(JNIEnv* env, jobject jcaller, | 414 static void DisableRedirects(JNIEnv* env, jobject jcaller, |
404 jlong jrequest_adapter) { | 415 jlong jrequest_adapter) { |
405 URLRequestAdapter* request_adapter = | 416 URLRequestAdapter* request_adapter = |
406 reinterpret_cast<URLRequestAdapter*>(jrequest_adapter); | 417 reinterpret_cast<URLRequestAdapter*>(jrequest_adapter); |
407 DCHECK(request_adapter); | 418 DCHECK(request_adapter); |
408 request_adapter->DisableRedirects(); | 419 request_adapter->DisableRedirects(); |
409 } | 420 } |
410 | 421 |
411 } // namespace cronet | 422 } // namespace cronet |
OLD | NEW |