| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 ScopedJavaLocalRef<jobject> java_bitmap = | 600 ScopedJavaLocalRef<jobject> java_bitmap = |
| 601 gfx::ConvertToJavaBitmap(&zoomed_bitmap); | 601 gfx::ConvertToJavaBitmap(&zoomed_bitmap); |
| 602 DCHECK(!java_bitmap.is_null()); | 602 DCHECK(!java_bitmap.is_null()); |
| 603 | 603 |
| 604 Java_ContentViewCore_showDisambiguationPopup(env, | 604 Java_ContentViewCore_showDisambiguationPopup(env, |
| 605 obj.obj(), | 605 obj.obj(), |
| 606 rect_object.obj(), | 606 rect_object.obj(), |
| 607 java_bitmap.obj()); | 607 java_bitmap.obj()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateSmoothScroller( |
| 611 bool scroll_down, int mouse_event_x, int mouse_event_y) { |
| 612 JNIEnv* env = AttachCurrentThread(); |
| 613 |
| 614 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 615 if (obj.is_null()) |
| 616 return ScopedJavaLocalRef<jobject>(); |
| 617 return Java_ContentViewCore_createSmoothScroller( |
| 618 env, obj.obj(), scroll_down, mouse_event_x, mouse_event_y); |
| 619 } |
| 620 |
| 610 gfx::Rect ContentViewCoreImpl::GetBounds() const { | 621 gfx::Rect ContentViewCoreImpl::GetBounds() const { |
| 611 JNIEnv* env = AttachCurrentThread(); | 622 JNIEnv* env = AttachCurrentThread(); |
| 612 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 623 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 613 if (j_obj.is_null()) | 624 if (j_obj.is_null()) |
| 614 return gfx::Rect(); | 625 return gfx::Rect(); |
| 615 return gfx::Rect(Java_ContentViewCore_getWidth(env, j_obj.obj()), | 626 return gfx::Rect(Java_ContentViewCore_getWidth(env, j_obj.obj()), |
| 616 Java_ContentViewCore_getHeight(env, j_obj.obj())); | 627 Java_ContentViewCore_getHeight(env, j_obj.obj())); |
| 617 } | 628 } |
| 618 | 629 |
| 619 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { | 630 void ContentViewCoreImpl::AttachLayer(scoped_refptr<cc::Layer> layer) { |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 1353 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
| 1343 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 1354 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
| 1344 return false; | 1355 return false; |
| 1345 } | 1356 } |
| 1346 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 1357 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
| 1347 | 1358 |
| 1348 return RegisterNativesImpl(env) >= 0; | 1359 return RegisterNativesImpl(env) >= 0; |
| 1349 } | 1360 } |
| 1350 | 1361 |
| 1351 } // namespace content | 1362 } // namespace content |
| OLD | NEW |