blob: e3df9a4272320924540978b38a71c85079091dce [file] [log] [blame]
Avi Drissman64595482022-09-14 20:52:291// Copyright 2012 The Chromium Authors
[email protected]d72acb02012-12-15 22:19:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]d72acb02012-12-15 22:19:445#include "base/android/jni_string.h"
Mohamed Heikal58800442019-06-22 00:19:486#include "net/net_jni_headers/GURLUtils_jni.h"
[email protected]f89276a72013-07-12 06:41:547#include "url/gurl.h"
[email protected]d72acb02012-12-15 22:19:448
torne86560112016-08-04 15:59:049using base::android::JavaParamRef;
10using base::android::ScopedJavaLocalRef;
11
[email protected]d72acb02012-12-15 22:19:4412namespace net {
13
Daniel Bratell7aacf952017-11-21 17:51:2514ScopedJavaLocalRef<jstring> JNI_GURLUtils_GetOrigin(
15 JNIEnv* env,
Daniel Bratell7aacf952017-11-21 17:51:2516 const JavaParamRef<jstring>& url) {
[email protected]d72acb02012-12-15 22:19:4417 GURL host(base::android::ConvertJavaStringToUTF16(env, url));
18
Mike West800532c2021-10-14 09:26:5219 return base::android::ConvertUTF8ToJavaString(
20 env, host.DeprecatedGetOriginAsURL().spec());
[email protected]d72acb02012-12-15 22:19:4421}
22
bncd479b3c2017-05-24 18:54:5323} // namespace net