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 #include "components/cronet/android/chromium_url_request.h" | 5 #include "components/cronet/android/chromium_url_request.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_adapter.h" | 10 #include "components/cronet/android/url_request_adapter.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 } | 380 } |
381 | 381 |
382 // Some implementations (notably HttpURLConnection) include a mapping for the | 382 // Some implementations (notably HttpURLConnection) include a mapping for the |
383 // null key; in HTTP's case, this maps to the HTTP status line. | 383 // null key; in HTTP's case, this maps to the HTTP status line. |
384 ScopedJavaLocalRef<jstring> status_line = | 384 ScopedJavaLocalRef<jstring> status_line = |
385 ConvertUTF8ToJavaString(env, headers->GetStatusLine()); | 385 ConvertUTF8ToJavaString(env, headers->GetStatusLine()); |
386 Java_ChromiumUrlRequest_onAppendResponseHeader( | 386 Java_ChromiumUrlRequest_onAppendResponseHeader( |
387 env, object, headersMap, NULL, status_line.Release()); | 387 env, object, headersMap, NULL, status_line.Release()); |
388 } | 388 } |
389 | 389 |
390 static jstring GetNegotiatedProtocol(JNIEnv* env, | |
391 jobject object, | |
392 jlong urlRequestAdapter) { | |
393 URLRequestAdapter* request = | |
394 reinterpret_cast<URLRequestAdapter*>(urlRequestAdapter); | |
395 if (request == NULL) { | |
mmenke
2014/09/09 14:53:35
Looks like we're pretty inconsistent about checkin
mef
2014/09/10 16:48:17
Acknowledged. I think we should have these checks
| |
396 return NULL; | |
397 } | |
398 std::string negotiated_protocol = request->GetNegotiatedProtocol(); | |
mmenke
2014/09/09 14:53:35
If we haven't negotiated a protocol yet, I assume
mef
2014/09/10 16:48:17
Done.
| |
399 return ConvertUTF8ToJavaString(env, negotiated_protocol.c_str()).Release(); | |
400 } | |
401 | |
390 } // namespace cronet | 402 } // namespace cronet |
OLD | NEW |