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"
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
);