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 "content/browser/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 ScopedJavaLocalRef<jobject> java_bitmap = | 588 ScopedJavaLocalRef<jobject> java_bitmap = |
589 gfx::ConvertToJavaBitmap(&zoomed_bitmap); | 589 gfx::ConvertToJavaBitmap(&zoomed_bitmap); |
590 DCHECK(!java_bitmap.is_null()); | 590 DCHECK(!java_bitmap.is_null()); |
591 | 591 |
592 Java_ContentViewCore_showDisambiguationPopup(env, | 592 Java_ContentViewCore_showDisambiguationPopup(env, |
593 obj.obj(), | 593 obj.obj(), |
594 rect_object.obj(), | 594 rect_object.obj(), |
595 java_bitmap.obj()); | 595 java_bitmap.obj()); |
596 } | 596 } |
597 | 597 |
| 598 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateSmoothScroller( |
| 599 bool scroll_down, int mouse_event_x, int mouse_event_y) { |
| 600 JNIEnv* env = AttachCurrentThread(); |
| 601 |
| 602 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 603 if (obj.is_null()) |
| 604 return ScopedJavaLocalRef<jobject>(); |
| 605 return Java_ContentViewCore_createSmoothScroller( |
| 606 env, obj.obj(), scroll_down, mouse_event_x, mouse_event_y); |
| 607 } |
| 608 |
598 gfx::Rect ContentViewCoreImpl::GetBounds() const { | 609 gfx::Rect ContentViewCoreImpl::GetBounds() const { |
599 JNIEnv* env = AttachCurrentThread(); | 610 JNIEnv* env = AttachCurrentThread(); |
600 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 611 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
601 if (j_obj.is_null()) | 612 if (j_obj.is_null()) |
602 return gfx::Rect(); | 613 return gfx::Rect(); |
603 return gfx::Rect(Java_ContentViewCore_getWidth(env, j_obj.obj()), | 614 return gfx::Rect(Java_ContentViewCore_getWidth(env, j_obj.obj()), |
604 Java_ContentViewCore_getHeight(env, j_obj.obj())); | 615 Java_ContentViewCore_getHeight(env, j_obj.obj())); |
605 } | 616 } |
606 | 617 |
607 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { | 618 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1293 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
1283 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1294 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
1284 return false; | 1295 return false; |
1285 } | 1296 } |
1286 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1297 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
1287 | 1298 |
1288 return RegisterNativesImpl(env) >= 0; | 1299 return RegisterNativesImpl(env) >= 0; |
1289 } | 1300 } |
1290 | 1301 |
1291 } // namespace content | 1302 } // namespace content |
OLD | NEW |