Enable maximize mode when keyboard is open past 180 degrees.
[chromium-blink-merge.git] / android_webview / native / intercepted_request_data_impl.cc
blob8b583dfd582163e186490f7b4bedb6e34a10d010
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "android_webview/native/intercepted_request_data_impl.h"
7 #include "android_webview/native/input_stream_impl.h"
8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h"
10 #include "jni/InterceptedRequestData_jni.h"
11 #include "net/url_request/url_request.h"
12 #include "net/url_request/url_request_job.h"
14 using base::android::ScopedJavaLocalRef;
16 namespace android_webview {
18 InterceptedRequestDataImpl::InterceptedRequestDataImpl(
19 const base::android::JavaRef<jobject>& obj)
20 : java_object_(obj) {
23 InterceptedRequestDataImpl::~InterceptedRequestDataImpl() {
26 scoped_ptr<InputStream>
27 InterceptedRequestDataImpl::GetInputStream(JNIEnv* env) const {
28 ScopedJavaLocalRef<jobject> jstream =
29 Java_InterceptedRequestData_getData(env, java_object_.obj());
30 if (jstream.is_null())
31 return scoped_ptr<InputStream>();
32 return make_scoped_ptr<InputStream>(new InputStreamImpl(jstream));
35 bool InterceptedRequestDataImpl::GetMimeType(JNIEnv* env,
36 std::string* mime_type) const {
37 ScopedJavaLocalRef<jstring> jstring_mime_type =
38 Java_InterceptedRequestData_getMimeType(env, java_object_.obj());
39 if (jstring_mime_type.is_null())
40 return false;
41 *mime_type = ConvertJavaStringToUTF8(jstring_mime_type);
42 return true;
45 bool InterceptedRequestDataImpl::GetCharset(
46 JNIEnv* env, std::string* charset) const {
47 ScopedJavaLocalRef<jstring> jstring_charset =
48 Java_InterceptedRequestData_getCharset(env, java_object_.obj());
49 if (jstring_charset.is_null())
50 return false;
51 *charset = ConvertJavaStringToUTF8(jstring_charset);
52 return true;
55 bool RegisterInterceptedRequestData(JNIEnv* env) {
56 return RegisterNativesImpl(env);
59 } // namespace android_webview