mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-12-01 01:36:09 +03:00
31 lines
1.0 KiB
C++
31 lines
1.0 KiB
C++
// 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 "base/android/jni_string.h"
|
|
#include "jni/GURLUtils_jni.h"
|
|
#include "url/gurl.h"
|
|
|
|
using base::android::JavaParamRef;
|
|
using base::android::ScopedJavaLocalRef;
|
|
|
|
namespace net {
|
|
|
|
ScopedJavaLocalRef<jstring> GetOrigin(JNIEnv* env,
|
|
const JavaParamRef<jclass>& clazz,
|
|
const JavaParamRef<jstring>& url) {
|
|
GURL host(base::android::ConvertJavaStringToUTF16(env, url));
|
|
|
|
return base::android::ConvertUTF8ToJavaString(env, host.GetOrigin().spec());
|
|
}
|
|
|
|
ScopedJavaLocalRef<jstring> GetScheme(JNIEnv* env,
|
|
const JavaParamRef<jclass>& clazz,
|
|
const JavaParamRef<jstring>& url) {
|
|
GURL host(base::android::ConvertJavaStringToUTF16(env, url));
|
|
|
|
return base::android::ConvertUTF8ToJavaString(env, host.scheme());
|
|
}
|
|
|
|
} // namespace net
|