Index: net/android/gurl_utils.cc |
diff --git a/net/android/gurl_utils.cc b/net/android/gurl_utils.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..94d8e78b7f1a3d4f954eaa27cf0cb96ea5cde934 |
--- /dev/null |
+++ b/net/android/gurl_utils.cc |
@@ -0,0 +1,24 @@ |
+// 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 "net/android/gurl_utils.h" |
+ |
+#include "base/android/jni_string.h" |
+#include "googleurl/src/gurl.h" |
+#include "jni/GURLUtils_jni.h" |
+ |
+namespace net { |
+ |
+jstring GetOrigin(JNIEnv* env, jclass clazz, jstring url) { |
+ GURL host(base::android::ConvertJavaStringToUTF16(env, url)); |
+ |
+ return base::android::ConvertUTF8ToJavaString(env, |
+ host.GetOrigin().spec()).Release(); |
Yaron
2012/12/14 02:09:07
Hmm. You shouldn't need to manager this yourself.
|
+} |
+ |
+bool RegisterGURLUtils(JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |
+ |
+} // net namespace |