| 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 "android_webview/native/aw_web_resource_response_impl.h" | 5 #include "android_webview/native/aw_web_resource_response_impl.h" |
| 6 | 6 |
| 7 #include "android_webview/native/input_stream_impl.h" | 7 #include "android_webview/native/input_stream_impl.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 AwWebResourceResponseImpl::~AwWebResourceResponseImpl() { | 27 AwWebResourceResponseImpl::~AwWebResourceResponseImpl() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 std::unique_ptr<InputStream> AwWebResourceResponseImpl::GetInputStream( | 30 std::unique_ptr<InputStream> AwWebResourceResponseImpl::GetInputStream( |
| 31 JNIEnv* env) const { | 31 JNIEnv* env) const { |
| 32 ScopedJavaLocalRef<jobject> jstream = | 32 ScopedJavaLocalRef<jobject> jstream = |
| 33 Java_AwWebResourceResponse_getData(env, java_object_); | 33 Java_AwWebResourceResponse_getData(env, java_object_); |
| 34 if (jstream.is_null()) | 34 if (jstream.is_null()) |
| 35 return std::unique_ptr<InputStream>(); | 35 return std::unique_ptr<InputStream>(); |
| 36 return base::WrapUnique(new InputStreamImpl(jstream)); | 36 return base::MakeUnique<InputStreamImpl>(jstream); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool AwWebResourceResponseImpl::GetMimeType(JNIEnv* env, | 39 bool AwWebResourceResponseImpl::GetMimeType(JNIEnv* env, |
| 40 std::string* mime_type) const { | 40 std::string* mime_type) const { |
| 41 ScopedJavaLocalRef<jstring> jstring_mime_type = | 41 ScopedJavaLocalRef<jstring> jstring_mime_type = |
| 42 Java_AwWebResourceResponse_getMimeType(env, java_object_); | 42 Java_AwWebResourceResponse_getMimeType(env, java_object_); |
| 43 if (jstring_mime_type.is_null()) | 43 if (jstring_mime_type.is_null()) |
| 44 return false; | 44 return false; |
| 45 *mime_type = ConvertJavaStringToUTF8(jstring_mime_type); | 45 *mime_type = ConvertJavaStringToUTF8(jstring_mime_type); |
| 46 return true; | 46 return true; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 for(size_t i = 0; i < header_names.size(); ++i) { | 89 for(size_t i = 0; i < header_names.size(); ++i) { |
| 90 std::string header_line(header_names[i]); | 90 std::string header_line(header_names[i]); |
| 91 header_line.append(": "); | 91 header_line.append(": "); |
| 92 header_line.append(header_values[i]); | 92 header_line.append(header_values[i]); |
| 93 headers->AddHeader(header_line); | 93 headers->AddHeader(header_line); |
| 94 } | 94 } |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace android_webview | 98 } // namespace android_webview |
| OLD | NEW |