| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 if (url == null) { | 110 if (url == null) { |
| 111 throw new NullPointerException("URL is required"); | 111 throw new NullPointerException("URL is required"); |
| 112 } | 112 } |
| 113 mRequestContext = requestContext; | 113 mRequestContext = requestContext; |
| 114 mUrl = url; | 114 mUrl = url; |
| 115 mPriority = convertRequestPriority(priority); | 115 mPriority = convertRequestPriority(priority); |
| 116 mHeaders = headers; | 116 mHeaders = headers; |
| 117 mSink = sink; | 117 mSink = sink; |
| 118 mUrlRequestAdapter = nativeCreateRequestAdapter( | 118 mUrlRequestAdapter = nativeCreateRequestAdapter( |
| 119 mRequestContext.getChromiumUrlRequestContextAdapter(), | 119 mRequestContext.getUrlRequestContextAdapter(), mUrl, mPriority); |
| 120 mUrl, | |
| 121 mPriority); | |
| 122 mListener = listener; | 120 mListener = listener; |
| 123 } | 121 } |
| 124 | 122 |
| 125 @Override | 123 @Override |
| 126 public void setOffset(long offset) { | 124 public void setOffset(long offset) { |
| 127 mOffset = offset; | 125 mOffset = offset; |
| 128 if (offset != 0) { | 126 if (offset != 0) { |
| 129 addHeader("Range", "bytes=" + offset + "-"); | 127 addHeader("Range", "bytes=" + offset + "-"); |
| 130 } | 128 } |
| 131 } | 129 } |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 | 755 |
| 758 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 756 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
| 759 | 757 |
| 760 private native boolean nativeGetWasCached(long urlRequestAdapter); | 758 private native boolean nativeGetWasCached(long urlRequestAdapter); |
| 761 | 759 |
| 762 // Explicit class to work around JNI-generator generics confusion. | 760 // Explicit class to work around JNI-generator generics confusion. |
| 763 private static class ResponseHeadersMap extends | 761 private static class ResponseHeadersMap extends |
| 764 HashMap<String, List<String>> { | 762 HashMap<String, List<String>> { |
| 765 } | 763 } |
| 766 } | 764 } |
| OLD | NEW |