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

Side by Side Diff: android_webview/native/intercepted_request_data_impl.cc

Issue 284123004: [android_webview] Add more params to request intercepting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix accidentally broken test Created 6 years, 6 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
(Empty)
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.
4
5 #include "android_webview/native/intercepted_request_data_impl.h"
6
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"
13
14 using base::android::ScopedJavaLocalRef;
15
16 namespace android_webview {
17
18 InterceptedRequestDataImpl::InterceptedRequestDataImpl(
19 const base::android::JavaRef<jobject>& obj)
20 : java_object_(obj) {
21 }
22
23 InterceptedRequestDataImpl::~InterceptedRequestDataImpl() {
24 }
25
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));
33 }
34
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;
43 }
44
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;
53 }
54
55 bool RegisterInterceptedRequestData(JNIEnv* env) {
56 return RegisterNativesImpl(env);
57 }
58
59 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/intercepted_request_data_impl.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698