• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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 
5 #include "android/jni/autofill_request_url.h"
6 #include "android/jni/jni_utils.h"
7 
8 namespace android {
9 
GetQueryUrl()10 std::string AutofillRequestUrl::GetQueryUrl() {
11   JNIEnv* env = android::jni::GetJNIEnv();
12   jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
13   jmethodID method = env->GetStaticMethodID(bridgeClass, "getAutofillQueryUrl", "()Ljava/lang/String;");
14   jstring autofill_query_url = static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method));
15   std::string request_url = android::jni::JstringToStdString(env, autofill_query_url);
16   env->DeleteLocalRef(autofill_query_url);
17   env->DeleteLocalRef(bridgeClass);
18 
19   return request_url;
20 }
21 
22 } // namespace android
23