gurl_utils.cc 670 B

1234567891011121314151617181920212223
  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.
  4. #include "base/android/jni_string.h"
  5. #include "net/net_jni_headers/GURLUtils_jni.h"
  6. #include "url/gurl.h"
  7. using base::android::JavaParamRef;
  8. using base::android::ScopedJavaLocalRef;
  9. namespace net {
  10. ScopedJavaLocalRef<jstring> JNI_GURLUtils_GetOrigin(
  11. JNIEnv* env,
  12. const JavaParamRef<jstring>& url) {
  13. GURL host(base::android::ConvertJavaStringToUTF16(env, url));
  14. return base::android::ConvertUTF8ToJavaString(
  15. env, host.DeprecatedGetOriginAsURL().spec());
  16. }
  17. } // namespace net