OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cronet_bidirectional_stream_adapter.h" | 5 #include "cronet_bidirectional_stream_adapter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "net/http/http_util.h" | 25 #include "net/http/http_util.h" |
26 #include "net/quic/core/quic_protocol.h" | 26 #include "net/quic/core/quic_protocol.h" |
27 #include "net/spdy/spdy_header_block.h" | 27 #include "net/spdy/spdy_header_block.h" |
28 #include "net/ssl/ssl_info.h" | 28 #include "net/ssl/ssl_info.h" |
29 #include "net/url_request/http_user_agent_settings.h" | 29 #include "net/url_request/http_user_agent_settings.h" |
30 #include "net/url_request/url_request_context.h" | 30 #include "net/url_request/url_request_context.h" |
31 #include "url/gurl.h" | 31 #include "url/gurl.h" |
32 | 32 |
33 using base::android::ConvertUTF8ToJavaString; | 33 using base::android::ConvertUTF8ToJavaString; |
34 using base::android::ConvertJavaStringToUTF8; | 34 using base::android::ConvertJavaStringToUTF8; |
| 35 using base::android::ScopedJavaLocalRef; |
35 | 36 |
36 namespace cronet { | 37 namespace cronet { |
37 | 38 |
38 namespace { | 39 namespace { |
39 | 40 |
40 // As |GetArrayLength| makes no guarantees about the returned value (e.g., it | 41 // As |GetArrayLength| makes no guarantees about the returned value (e.g., it |
41 // may be -1 if |array| is not a valid Java array), provide a safe wrapper | 42 // may be -1 if |array| is not a valid Java array), provide a safe wrapper |
42 // that always returns a valid, non-negative size. | 43 // that always returns a valid, non-negative size. |
43 template <typename JavaArrayType> | 44 template <typename JavaArrayType> |
44 size_t SafeGetArrayLength(JNIEnv* env, JavaArrayType jarray) { | 45 size_t SafeGetArrayLength(JNIEnv* env, JavaArrayType jarray) { |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 422 |
422 std::vector<std::string> headers; | 423 std::vector<std::string> headers; |
423 for (const auto& header : header_block) { | 424 for (const auto& header : header_block) { |
424 headers.push_back(header.first.as_string()); | 425 headers.push_back(header.first.as_string()); |
425 headers.push_back(header.second.as_string()); | 426 headers.push_back(header.second.as_string()); |
426 } | 427 } |
427 return base::android::ToJavaArrayOfStrings(env, headers); | 428 return base::android::ToJavaArrayOfStrings(env, headers); |
428 } | 429 } |
429 | 430 |
430 } // namespace cronet | 431 } // namespace cronet |
OLD | NEW |