OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents_delegate_android/web_contents_delegate_android
.h" | 5 #include "components/web_contents_delegate_android/web_contents_delegate_android
.h" |
6 | 6 |
7 #include <android/keycodes.h> | 7 #include <android/keycodes.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ScopedJavaLocalRef<jstring> java_url = | 90 ScopedJavaLocalRef<jstring> java_url = |
91 ConvertUTF8ToJavaString(env, url.spec()); | 91 ConvertUTF8ToJavaString(env, url.spec()); |
92 ScopedJavaLocalRef<jstring> extra_headers = | 92 ScopedJavaLocalRef<jstring> extra_headers = |
93 ConvertUTF8ToJavaString(env, params.extra_headers); | 93 ConvertUTF8ToJavaString(env, params.extra_headers); |
94 ScopedJavaLocalRef<jbyteArray> post_data; | 94 ScopedJavaLocalRef<jbyteArray> post_data; |
95 if (params.uses_post && | 95 if (params.uses_post && |
96 params.browser_initiated_post_data.get() && | 96 params.browser_initiated_post_data.get() && |
97 params.browser_initiated_post_data.get()->size()) { | 97 params.browser_initiated_post_data.get()->size()) { |
98 post_data = base::android::ToJavaByteArray( | 98 post_data = base::android::ToJavaByteArray( |
99 env, | 99 env, |
100 reinterpret_cast<const uint8*>( | 100 params.browser_initiated_post_data.get()->front_as<uint8>(), |
101 params.browser_initiated_post_data.get()->front()), | |
102 params.browser_initiated_post_data.get()->size()); | 101 params.browser_initiated_post_data.get()->size()); |
103 } | 102 } |
104 Java_WebContentsDelegateAndroid_openNewTab(env, | 103 Java_WebContentsDelegateAndroid_openNewTab(env, |
105 obj.obj(), | 104 obj.obj(), |
106 java_url.obj(), | 105 java_url.obj(), |
107 extra_headers.obj(), | 106 extra_headers.obj(), |
108 post_data.obj(), | 107 post_data.obj(), |
109 disposition); | 108 disposition); |
110 return NULL; | 109 return NULL; |
111 } | 110 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // Native JNI methods | 347 // Native JNI methods |
349 // ---------------------------------------------------------------------------- | 348 // ---------------------------------------------------------------------------- |
350 | 349 |
351 // Register native methods | 350 // Register native methods |
352 | 351 |
353 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 352 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
354 return RegisterNativesImpl(env); | 353 return RegisterNativesImpl(env); |
355 } | 354 } |
356 | 355 |
357 } // namespace web_contents_delegate_android | 356 } // namespace web_contents_delegate_android |
OLD | NEW |