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 return Java_NavigationParams_create(
22 env
, jstring_url
.obj(), params
.is_post(), params
.has_user_gesture(),
23 params
.transition_type(), params
.is_redirect(),
24 params
.is_external_protocol(), has_user_gesture_carryover
);
27 // Register native methods.
29 bool RegisterNavigationParams(JNIEnv
* env
) {
30 return RegisterNativesImpl(env
);
33 } // namespace navigation_interception