| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( | 309 bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending( |
| 310 const WebContents* web_contents) const { | 310 const WebContents* web_contents) const { |
| 311 JNIEnv* env = AttachCurrentThread(); | 311 JNIEnv* env = AttachCurrentThread(); |
| 312 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); | 312 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 313 if (obj.is_null()) | 313 if (obj.is_null()) |
| 314 return false; | 314 return false; |
| 315 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( | 315 return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending( |
| 316 env, obj.obj()); | 316 env, obj.obj()); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void WebContentsDelegateAndroid::DidProgrammaticallyScroll( |
| 320 WebContents* web_contents, const gfx::Vector2d& scroll_point) { |
| 321 JNIEnv* env = AttachCurrentThread(); |
| 322 ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); |
| 323 if (obj.is_null()) |
| 324 return; |
| 325 Java_WebContentsDelegateAndroid_didProgrammaticallyScroll( |
| 326 env, obj.obj(), scroll_point.x(), scroll_point.y()); |
| 327 } |
| 328 |
| 319 // ---------------------------------------------------------------------------- | 329 // ---------------------------------------------------------------------------- |
| 320 // Native JNI methods | 330 // Native JNI methods |
| 321 // ---------------------------------------------------------------------------- | 331 // ---------------------------------------------------------------------------- |
| 322 | 332 |
| 323 // Register native methods | 333 // Register native methods |
| 324 | 334 |
| 325 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { | 335 bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { |
| 326 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { | 336 if (!HasClass(env, kWebContentsDelegateAndroidClassPath)) { |
| 327 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; | 337 DLOG(ERROR) << "Unable to find class WebContentsDelegateAndroid!"; |
| 328 return false; | 338 return false; |
| 329 } | 339 } |
| 330 return RegisterNativesImpl(env); | 340 return RegisterNativesImpl(env); |
| 331 } | 341 } |
| 332 | 342 |
| 333 } // namespace components | 343 } // namespace components |
| OLD | NEW |