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; |
11 import org.chromium.base.JNINamespace; | 11 import org.chromium.base.JNINamespace; |
12 import org.chromium.base.annotations.SuppressFBWarnings; | |
13 | 12 |
14 import java.io.IOException; | 13 import java.io.IOException; |
15 import java.net.MalformedURLException; | 14 import java.net.MalformedURLException; |
16 import java.net.URL; | 15 import java.net.URL; |
17 import java.net.UnknownHostException; | 16 import java.net.UnknownHostException; |
18 import java.nio.ByteBuffer; | 17 import java.nio.ByteBuffer; |
19 import java.nio.channels.ReadableByteChannel; | 18 import java.nio.channels.ReadableByteChannel; |
20 import java.nio.channels.WritableByteChannel; | 19 import java.nio.channels.WritableByteChannel; |
21 import java.util.ArrayList; | 20 import java.util.ArrayList; |
22 import java.util.HashMap; | 21 import java.util.HashMap; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 215 } |
217 | 216 |
218 /** | 217 /** |
219 * Sets data to upload as part of a POST or PUT request. | 218 * Sets data to upload as part of a POST or PUT request. |
220 * | 219 * |
221 * @param contentType MIME type of the upload content or null if this is not | 220 * @param contentType MIME type of the upload content or null if this is not |
222 * an upload. | 221 * an upload. |
223 * @param data The content that needs to be uploaded. | 222 * @param data The content that needs to be uploaded. |
224 */ | 223 */ |
225 @Override | 224 @Override |
226 @SuppressFBWarnings("EI_EXPOSE_REP2") | |
227 public void setUploadData(String contentType, byte[] data) { | 225 public void setUploadData(String contentType, byte[] data) { |
228 synchronized (mLock) { | 226 synchronized (mLock) { |
229 validateNotStarted(); | 227 validateNotStarted(); |
230 validateContentType(contentType); | 228 validateContentType(contentType); |
231 mUploadContentType = contentType; | 229 mUploadContentType = contentType; |
232 mUploadData = data; | 230 mUploadData = data; |
233 mUploadChannel = null; | 231 mUploadChannel = null; |
234 mChunkedUpload = false; | 232 mChunkedUpload = false; |
235 } | 233 } |
236 } | 234 } |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 private native void nativeGetAllHeaders(long urlRequestAdapter, | 718 private native void nativeGetAllHeaders(long urlRequestAdapter, |
721 ResponseHeadersMap headers); | 719 ResponseHeadersMap headers); |
722 | 720 |
723 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); | 721 private native String nativeGetNegotiatedProtocol(long urlRequestAdapter); |
724 | 722 |
725 // Explicit class to work around JNI-generator generics confusion. | 723 // Explicit class to work around JNI-generator generics confusion. |
726 private static class ResponseHeadersMap extends | 724 private static class ResponseHeadersMap extends |
727 HashMap<String, List<String>> { | 725 HashMap<String, List<String>> { |
728 } | 726 } |
729 } | 727 } |
OLD | NEW |