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

Unified Diff: android_webview/native/intercepted_request_data.cc

Issue 10855171: Add a test runner for android_webview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address feedback Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/native/intercepted_request_data.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/intercepted_request_data.cc
diff --git a/android_webview/native/intercepted_request_data.cc b/android_webview/native/intercepted_request_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80649bd646fed20d1b82bcddb6b3f7d0c0389cbd
--- /dev/null
+++ b/android_webview/native/intercepted_request_data.cc
@@ -0,0 +1,55 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/native/intercepted_request_data.h"
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "jni/InterceptedRequestData_jni.h"
+
+using std::string;
+using base::android::ScopedJavaLocalRef;
+
+InterceptedRequestData::InterceptedRequestData(
+ JNIEnv* env, base::android::JavaRef<jobject> obj) {
+ java_object_.Reset(env, obj.obj());
+}
+
+InterceptedRequestData::~InterceptedRequestData() {
+}
+
+ScopedJavaLocalRef<jobject>
+InterceptedRequestData::GetInputStream(JNIEnv* env) const {
+ return Java_InterceptedRequestData_getData(env, java_object_.obj());
+}
+
+bool InterceptedRequestData::GetMimeType(JNIEnv* env,
+ string* mime_type) const {
+ ScopedJavaLocalRef<jstring> jstring_mime_type =
+ Java_InterceptedRequestData_getMimeType(env, java_object_.obj());
+ if (jstring_mime_type.is_null())
+ return false;
+ *mime_type = ConvertJavaStringToUTF8(jstring_mime_type);
+ return true;
+}
+
+bool InterceptedRequestData::GetCharset(
+ JNIEnv* env, string* charset) const {
+ ScopedJavaLocalRef<jstring> jstring_charset =
+ Java_InterceptedRequestData_getCharset(env, java_object_.obj());
+ if (jstring_charset.is_null())
+ return false;
+ *charset = ConvertJavaStringToUTF8(jstring_charset);
+ return true;
+}
+
+bool RegisterInterceptedRequestData(JNIEnv* env) {
+ if (g_InterceptedRequestData_clazz)
+ return true;
+ if (!base::android::HasClass(env, kInterceptedRequestDataClassPath)) {
+ DLOG(ERROR) << "Unable to find class InterceptedRequestData!";
+ return false;
+ }
+ return RegisterNativesImpl(env);
+}
« no previous file with comments | « android_webview/native/intercepted_request_data.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698