Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: components/cronet/android/org_chromium_net_UrlRequest.cc

Issue 268353013: Upstream changes to HttpUrlRequest for querying response headers and closing ReadableByteChannel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comment. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/org_chromium_net_UrlRequest.h" 5 #include "components/cronet/android/org_chromium_net_UrlRequest.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_context_peer.h" 10 #include "components/cronet/android/url_request_context_peer.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 static jlong GetContentLength(JNIEnv* env, 294 static jlong GetContentLength(JNIEnv* env,
295 jobject object, 295 jobject object,
296 jlong urlRequestPeer) { 296 jlong urlRequestPeer) {
297 URLRequestPeer* request = reinterpret_cast<URLRequestPeer*>(urlRequestPeer); 297 URLRequestPeer* request = reinterpret_cast<URLRequestPeer*>(urlRequestPeer);
298 if (request == NULL) { 298 if (request == NULL) {
299 return 0; 299 return 0;
300 } 300 }
301 return request->content_length(); 301 return request->content_length();
302 } 302 }
303 303
304 static jstring GetHeader(
305 JNIEnv* env, jobject object, jlong urlRequestPeer, jstring name) {
306 URLRequestPeer* request = reinterpret_cast<URLRequestPeer*>(urlRequestPeer);
307 if (request == NULL) {
308 return NULL;
309 }
310
311 std::string name_string = base::android::ConvertJavaStringToUTF8(env, name);
312 std::string value = request->GetHeader(name_string);
313 if (!value.empty()) {
314 return ConvertUTF8ToJavaString(env, value.c_str()).Release();
315 } else {
316 return NULL;
317 }
318 }
319
304 } // namespace cronet 320 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/java/src/org/chromium/net/UrlRequest.java ('k') | components/cronet/android/url_request_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698