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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 disposition == NEW_BACKGROUND_TAB || | 84 disposition == NEW_BACKGROUND_TAB || |
85 disposition == OFF_THE_RECORD) { | 85 disposition == OFF_THE_RECORD) { |
86 JNIEnv* env = AttachCurrentThread(); | 86 JNIEnv* env = AttachCurrentThread(); |
87 ScopedJavaLocalRef<jstring> java_url = | 87 ScopedJavaLocalRef<jstring> java_url = |
88 ConvertUTF8ToJavaString(env, url.spec()); | 88 ConvertUTF8ToJavaString(env, url.spec()); |
89 ScopedJavaLocalRef<jstring> extra_headers = | 89 ScopedJavaLocalRef<jstring> extra_headers = |
90 ConvertUTF8ToJavaString(env, params.extra_headers); | 90 ConvertUTF8ToJavaString(env, params.extra_headers); |
91 ScopedJavaLocalRef<jbyteArray> post_data; | 91 ScopedJavaLocalRef<jbyteArray> post_data; |
92 if (params.uses_post && | 92 if (params.uses_post && |
93 params.browser_initiated_post_data.get() && | 93 params.browser_initiated_post_data.get() && |
94 params.browser_initiated_post_data.get()->size()) { | 94 params.browser_initiated_post_data->size()) { |
95 post_data = base::android::ToJavaByteArray( | 95 post_data = base::android::ToJavaByteArray( |
96 env, | 96 env, |
97 reinterpret_cast<const uint8*>( | 97 reinterpret_cast<const uint8*>( |
98 params.browser_initiated_post_data.get()->front()), | 98 params.browser_initiated_post_data->front()), |
99 params.browser_initiated_post_data.get()->size()); | 99 params.browser_initiated_post_data->size()); |
joth
2013/08/06 04:04:21
could you put these .get() back? rsleevi was purpo
Kibeom Kim (inactive)
2013/08/06 04:36:01
Done.
| |
100 } | 100 } |
101 Java_WebContentsDelegateAndroid_openNewTab(env, | 101 Java_WebContentsDelegateAndroid_openNewTab(env, |
102 obj.obj(), | 102 obj.obj(), |
103 java_url.obj(), | 103 java_url.obj(), |
104 extra_headers.obj(), | 104 extra_headers.obj(), |
105 post_data.obj(), | 105 post_data.obj(), |
106 disposition == OFF_THE_RECORD); | 106 disposition); |
107 return NULL; | 107 return NULL; |
108 } | 108 } |
109 | 109 |
110 source->GetController().LoadURL(url, params.referrer, transition, | 110 source->GetController().LoadURL(url, params.referrer, transition, |
111 std::string()); | 111 std::string()); |
112 return source; | 112 return source; |
113 } | 113 } |
114 | 114 |
115 void WebContentsDelegateAndroid::NavigationStateChanged( | 115 void WebContentsDelegateAndroid::NavigationStateChanged( |
116 const WebContents* source, unsigned changed_flags) { | 116 const WebContents* source, unsigned changed_flags) { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 | 352 |
353 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 353 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
354 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 354 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
355 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 355 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
356 return false; | 356 return false; |
357 } | 357 } |
358 return RegisterNativesImpl(env); | 358 return RegisterNativesImpl(env); |
359 } | 359 } |
360 | 360 |
361 } // namespace web_contents_delegate_android | 361 } // namespace web_contents_delegate_android |
OLD | NEW |