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_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( | 293 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( |
294 const WebContents* web_contents) const { | 294 const WebContents* web_contents) const { |
295 JNIEnv* env = AttachCurrentThread(); | 295 JNIEnv* env = AttachCurrentThread(); |
296 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 296 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
297 if (obj.is_null()) | 297 if (obj.is_null()) |
298 return false; | 298 return false; |
299 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( | 299 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( |
300 env, obj.obj()); | 300 env, obj.obj()); |
301 } | 301 } |
302 | 302 |
| 303 void WebContentsDelegateAndroid::DidProgrammaticallyScroll( |
| 304 WebContents* web_contents, const gfx::Point& scroll_point) { |
| 305 JNIEnv* env = AttachCurrentThread(); |
| 306 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 307 if (obj.is_null()) |
| 308 return; |
| 309 Java_WebContentsDelegateAndroid_didProgrammaticallyScroll( |
| 310 env, obj.obj(), scroll_point.x(), scroll_point.y()); |
| 311 } |
| 312 |
303 // ---------------------------------------------------------------------------- | 313 // ---------------------------------------------------------------------------- |
304 // Native JNI methods | 314 // Native JNI methods |
305 // ---------------------------------------------------------------------------- | 315 // ---------------------------------------------------------------------------- |
306 | 316 |
307 // Register native methods | 317 // Register native methods |
308 | 318 |
309 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 319 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
310 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 320 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
311 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 321 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
312 return false; | 322 return false; |
313 } | 323 } |
314 return RegisterNativesImpl(env); | 324 return RegisterNativesImpl(env); |
315 } | 325 } |
316 | 326 |
317 } // namespace components | 327 } // namespace components |
OLD | NEW |