Roll src/third_party/skia 93558dc:e9a3e3c
[chromium-blink-merge.git] / components / navigation_interception / navigation_params_android.cc
blobe6848d8853b26726f89ed90a80276835daad4ae9
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(
15 JNIEnv* env,
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(
25 env,
26 jstring_url.obj(),
27 jstring_referrer.obj(),
28 params.is_post(),
29 params.has_user_gesture(),
30 params.transition_type(),
31 params.is_redirect(),
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