1 // Copyright (c) 2013 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.
5 #include "components/navigation_interception/navigation_params_android.h"
7 #include "base/android/jni_string.h"
8 #include "jni/NavigationParams_jni.h"
10 using base::android::ConvertUTF8ToJavaString
;
12 namespace navigation_interception
{
14 base::android::ScopedJavaLocalRef
<jobject
> CreateJavaNavigationParams(
16 const NavigationParams
& params
,
17 bool has_user_gesture_carryover
) {
18 ScopedJavaLocalRef
<jstring
> jstring_url
=
19 ConvertUTF8ToJavaString(env
, params
.url().spec());
21 ScopedJavaLocalRef
<jstring
> jstring_referrer
=
22 ConvertUTF8ToJavaString(env
, params
.referrer().url
.spec());
24 return Java_NavigationParams_create(
27 jstring_referrer
.obj(),
29 params
.has_user_gesture(),
30 params
.transition_type(),
32 params
.is_external_protocol(),
33 params
.is_main_frame(),
34 has_user_gesture_carryover
);
37 // Register native methods.
39 bool RegisterNavigationParams(JNIEnv
* env
) {
40 return RegisterNativesImpl(env
);
43 } // namespace navigation_interception