Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / net / android / gurl_utils.cc
blob5b2ff3f8ccc0254a5aa14ecbb0afca026ad2f8b2
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 "net/android/gurl_utils.h"
7 #include "base/android/jni_string.h"
8 #include "jni/GURLUtils_jni.h"
9 #include "url/gurl.h"
11 namespace net {
13 ScopedJavaLocalRef<jstring> GetOrigin(JNIEnv* env,
14 const JavaParamRef<jclass>& clazz,
15 const JavaParamRef<jstring>& url) {
16 GURL host(base::android::ConvertJavaStringToUTF16(env, url));
18 return base::android::ConvertUTF8ToJavaString(env, host.GetOrigin().spec());
21 ScopedJavaLocalRef<jstring> GetScheme(JNIEnv* env,
22 const JavaParamRef<jclass>& clazz,
23 const JavaParamRef<jstring>& url) {
24 GURL host(base::android::ConvertJavaStringToUTF16(env, url));
26 return base::android::ConvertUTF8ToJavaString(env, host.scheme());
29 bool RegisterGURLUtils(JNIEnv* env) {
30 return RegisterNativesImpl(env);
33 } // net namespace