OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/navigation_interception/navigation_params_android.h" | 5 #include "components/navigation_interception/navigation_params_android.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "jni/NavigationParams_jni.h" | 8 #include "jni/NavigationParams_jni.h" |
9 | 9 |
10 using base::android::ConvertUTF8ToJavaString; | 10 using base::android::ConvertUTF8ToJavaString; |
| 11 using base::android::ScopedJavaLocalRef; |
11 | 12 |
12 namespace navigation_interception { | 13 namespace navigation_interception { |
13 | 14 |
14 base::android::ScopedJavaLocalRef<jobject> CreateJavaNavigationParams( | 15 base::android::ScopedJavaLocalRef<jobject> CreateJavaNavigationParams( |
15 JNIEnv* env, | 16 JNIEnv* env, |
16 const NavigationParams& params, | 17 const NavigationParams& params, |
17 bool has_user_gesture_carryover) { | 18 bool has_user_gesture_carryover) { |
18 ScopedJavaLocalRef<jstring> jstring_url = | 19 ScopedJavaLocalRef<jstring> jstring_url = |
19 ConvertUTF8ToJavaString(env, params.url().spec()); | 20 ConvertUTF8ToJavaString(env, params.url().spec()); |
20 | 21 |
21 ScopedJavaLocalRef<jstring> jstring_referrer = | 22 ScopedJavaLocalRef<jstring> jstring_referrer = |
22 ConvertUTF8ToJavaString(env, params.referrer().url.spec()); | 23 ConvertUTF8ToJavaString(env, params.referrer().url.spec()); |
23 | 24 |
24 return Java_NavigationParams_create( | 25 return Java_NavigationParams_create( |
25 env, | 26 env, |
26 jstring_url.obj(), | 27 jstring_url.obj(), |
27 jstring_referrer.obj(), | 28 jstring_referrer.obj(), |
28 params.is_post(), | 29 params.is_post(), |
29 params.has_user_gesture(), | 30 params.has_user_gesture(), |
30 params.transition_type(), | 31 params.transition_type(), |
31 params.is_redirect(), | 32 params.is_redirect(), |
32 params.is_external_protocol(), | 33 params.is_external_protocol(), |
33 params.is_main_frame(), | 34 params.is_main_frame(), |
34 has_user_gesture_carryover); | 35 has_user_gesture_carryover); |
35 } | 36 } |
36 | 37 |
37 } // namespace navigation_interception | 38 } // namespace navigation_interception |
OLD | NEW |