summaryrefslogtreecommitdiffstats
path: root/chromium/net/android/gurl_utils.cc
blob: a495cfed88085454e695b880f54d55e890c8f201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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 "net/net_jni_headers/GURLUtils_jni.h"
#include "url/gurl.h"

using base::android::JavaParamRef;
using base::android::ScopedJavaLocalRef;

namespace net {

ScopedJavaLocalRef<jstring> JNI_GURLUtils_GetOrigin(
    JNIEnv* env,
    const JavaParamRef<jstring>& url) {
  GURL host(base::android::ConvertJavaStringToUTF16(env, url));

  return base::android::ConvertUTF8ToJavaString(env, host.GetOrigin().spec());
}

}  // namespace net