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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 WebContents* source, | 128 WebContents* source, |
129 WebContents* new_contents, | 129 WebContents* new_contents, |
130 WindowOpenDisposition disposition, | 130 WindowOpenDisposition disposition, |
131 const gfx::Rect& initial_pos, | 131 const gfx::Rect& initial_pos, |
132 bool user_gesture, | 132 bool user_gesture, |
133 bool* was_blocked) { | 133 bool* was_blocked) { |
134 JNIEnv* env = AttachCurrentThread(); | 134 JNIEnv* env = AttachCurrentThread(); |
135 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 135 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
136 bool handled = false; | 136 bool handled = false; |
137 if (!obj.is_null()) { | 137 if (!obj.is_null()) { |
138 handled = Java_WebContentsDelegateAndroid_addNewContents( | 138 handled = Java_WebContentsDelegateAndroid_addNewContents( |
joth
2013/08/20 22:44:36
note this method isn't used in webview (see https:
David Trainor- moved to gerrit
2013/08/21 17:25:13
If you guys don't use it sure!
Yaron
2013/08/21 19:07:58
+1
| |
139 env, | 139 env, |
140 obj.obj(), | 140 obj.obj(), |
141 reinterpret_cast<jint>(source), | 141 reinterpret_cast<jint>(source), |
142 reinterpret_cast<jint>(new_contents), | 142 reinterpret_cast<jint>(new_contents), |
143 static_cast<jint>(disposition), | 143 static_cast<jint>(disposition), |
144 NULL, | 144 NULL, |
145 user_gesture); | 145 user_gesture); |
146 } | 146 } |
147 | |
148 if (was_blocked) | |
149 *was_blocked = false; | |
joth
2013/08/20 22:44:36
seems like this should be !handled instead of fal
David Trainor- moved to gerrit
2013/08/21 17:25:13
I wasn't sure if whether or not we handled it actu
| |
150 | |
147 if (!handled) | 151 if (!handled) |
148 delete new_contents; | 152 delete new_contents; |
149 } | 153 } |
150 | 154 |
151 void WebContentsDelegateAndroid::ActivateContents(WebContents* contents) { | 155 void WebContentsDelegateAndroid::ActivateContents(WebContents* contents) { |
152 JNIEnv* env = AttachCurrentThread(); | 156 JNIEnv* env = AttachCurrentThread(); |
153 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 157 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
154 if (obj.is_null()) | 158 if (obj.is_null()) |
155 return; | 159 return; |
156 Java_WebContentsDelegateAndroid_activateContents(env, obj.obj()); | 160 Java_WebContentsDelegateAndroid_activateContents(env, obj.obj()); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 | 356 |
353 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 357 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
354 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 358 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
355 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 359 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
356 return false; | 360 return false; |
357 } | 361 } |
358 return RegisterNativesImpl(env); | 362 return RegisterNativesImpl(env); |
359 } | 363 } |
360 | 364 |
361 } // namespace web_contents_delegate_android | 365 } // namespace web_contents_delegate_android |
OLD | NEW |