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