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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 } | 575 } |
576 | 576 |
577 // -------------------------------------------------------------------------- | 577 // -------------------------------------------------------------------------- |
578 // Public methods that call to Java via JNI | 578 // Public methods that call to Java via JNI |
579 // -------------------------------------------------------------------------- | 579 // -------------------------------------------------------------------------- |
580 | 580 |
581 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) { | 581 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) { |
582 NOTIMPLEMENTED() << "not upstreamed yet"; | 582 NOTIMPLEMENTED() << "not upstreamed yet"; |
583 } | 583 } |
584 | 584 |
| 585 void ContentViewCoreImpl::UpdateContentSize(int width, int height) { |
| 586 JNIEnv* env = AttachCurrentThread(); |
| 587 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 588 if (obj.is_null()) |
| 589 return; |
| 590 Java_ContentViewCore_updateContentSize(env, obj.obj(), width, height); |
| 591 } |
| 592 |
| 593 void ContentViewCoreImpl::UpdateScrollOffsetAndPageScaleFactor(int x, int y, |
| 594 float scale) { |
| 595 JNIEnv* env = AttachCurrentThread(); |
| 596 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 597 if (obj.is_null()) |
| 598 return; |
| 599 Java_ContentViewCore_updateScrollOffsetAndPageScaleFactor(env, obj.obj(), x, |
| 600 y, scale); |
| 601 } |
| 602 |
585 void ContentViewCoreImpl::ImeUpdateAdapter(int native_ime_adapter, | 603 void ContentViewCoreImpl::ImeUpdateAdapter(int native_ime_adapter, |
586 int text_input_type, | 604 int text_input_type, |
587 const std::string& text, | 605 const std::string& text, |
588 int selection_start, | 606 int selection_start, |
589 int selection_end, | 607 int selection_end, |
590 int composition_start, | 608 int composition_start, |
591 int composition_end, | 609 int composition_end, |
592 bool show_ime_if_needed) { | 610 bool show_ime_if_needed) { |
593 JNIEnv* env = AttachCurrentThread(); | 611 JNIEnv* env = AttachCurrentThread(); |
594 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 612 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 750 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
733 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 751 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
734 return false; | 752 return false; |
735 } | 753 } |
736 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 754 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
737 | 755 |
738 return RegisterNativesImpl(env) >= 0; | 756 return RegisterNativesImpl(env) >= 0; |
739 } | 757 } |
740 | 758 |
741 } // namespace content | 759 } // namespace content |
OLD | NEW |