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 package org.chromium.net; | 5 package org.chromium.net; |
6 | 6 |
7 import android.util.Log; | 7 import android.util.Log; |
8 | 8 |
9 import org.apache.http.conn.ConnectTimeoutException; | 9 import org.apache.http.conn.ConnectTimeoutException; |
10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 @Override | 415 @Override |
416 public String getNegotiatedProtocol() { | 416 public String getNegotiatedProtocol() { |
417 synchronized (mLock) { | 417 synchronized (mLock) { |
418 validateNativeAdapterNotDestroyed(); | 418 validateNativeAdapterNotDestroyed(); |
419 validateHeadersAvailable(); | 419 validateHeadersAvailable(); |
420 return nativeGetNegotiatedProtocol(mUrlRequestAdapter); | 420 return nativeGetNegotiatedProtocol(mUrlRequestAdapter); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 @Override | 424 @Override |
| 425 public boolean wasCached() { |
| 426 synchronized (mLock) { |
| 427 validateNativeAdapterNotDestroyed(); |
| 428 validateHeadersAvailable(); |
| 429 return nativeGetWasCached(mUrlRequestAdapter); |
| 430 } |
| 431 } |
| 432 |
| 433 @Override |
425 public String getContentType() { | 434 public String getContentType() { |
426 return mContentType; | 435 return mContentType; |
427 } | 436 } |
428 | 437 |
429 @Override | 438 @Override |
430 public String getHeader(String name) { | 439 public String getHeader(String name) { |
431 synchronized (mLock) { | 440 synchronized (mLock) { |
432 validateNativeAdapterNotDestroyed(); | 441 validateNativeAdapterNotDestroyed(); |
433 validateHeadersAvailable(); | 442 validateHeadersAvailable(); |
434 return nativeGetHeader(mUrlRequestAdapter, name); | 443 return nativeGetHeader(mUrlRequestAdapter, name); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 750 |
742 private native long nativeGetContentLength(long urlRequestAdapter); | 751 private native long nativeGetContentLength(long urlRequestAdapter); |
743 | 752 |
744 private native String nativeGetHeader(long urlRequestAdapter, String name); | 753 private native String nativeGetHeader(long urlRequestAdapter, String name); |
745 | 754 |
746 private native void nativeGetAllHeaders(long urlRequestAdapter, | 755 private native void nativeGetAllHeaders(long urlRequestAdapter, |
747 ResponseHeadersMap headers); | 756 ResponseHeadersMap headers); |
748 | 757 |
749 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 758 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
750 | 759 |
| 760 private native boolean nativeGetWasCached(long urlRequestAdapter); |
| 761 |
751 // Explicit class to work around JNI-generator generics confusion. | 762 // Explicit class to work around JNI-generator generics confusion. |
752 private static class ResponseHeadersMap extends | 763 private static class ResponseHeadersMap extends |
753 HashMap<String, List<String>> { | 764 HashMap<String, List<String>> { |
754 } | 765 } |
755 } | 766 } |
OLD | NEW |