| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 } | 549 } |
| 550 | 550 |
| 551 // -------------------------------------------------------------------------- | 551 // -------------------------------------------------------------------------- |
| 552 // Public methods that call to Java via JNI | 552 // Public methods that call to Java via JNI |
| 553 // -------------------------------------------------------------------------- | 553 // -------------------------------------------------------------------------- |
| 554 | 554 |
| 555 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) { | 555 void ContentViewCoreImpl::OnTabCrashed(const base::ProcessHandle handle) { |
| 556 NOTIMPLEMENTED() << "not upstreamed yet"; | 556 NOTIMPLEMENTED() << "not upstreamed yet"; |
| 557 } | 557 } |
| 558 | 558 |
| 559 void ContentViewCoreImpl::UpdateContentSize(int width, int height) { |
| 560 JNIEnv* env = AttachCurrentThread(); |
| 561 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 562 if (obj.is_null()) |
| 563 return; |
| 564 Java_ContentViewCore_updateContentSize(env, obj.obj(), width, height); |
| 565 } |
| 566 |
| 567 void ContentViewCoreImpl::UpdateScrollOffsetAndPageScaleFactor(int x, int y, |
| 568 float scale) { |
| 569 JNIEnv* env = AttachCurrentThread(); |
| 570 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 571 if (obj.is_null()) |
| 572 return; |
| 573 Java_ContentViewCore_updateScrollOffsetAndPageScaleFactor(env, obj.obj(), x, |
| 574 y, scale); |
| 575 } |
| 576 |
| 559 void ContentViewCoreImpl::ImeUpdateAdapter(int native_ime_adapter, | 577 void ContentViewCoreImpl::ImeUpdateAdapter(int native_ime_adapter, |
| 560 int text_input_type, | 578 int text_input_type, |
| 561 const std::string& text, | 579 const std::string& text, |
| 562 int selection_start, | 580 int selection_start, |
| 563 int selection_end, | 581 int selection_end, |
| 564 int composition_start, | 582 int composition_start, |
| 565 int composition_end, | 583 int composition_end, |
| 566 bool show_ime_if_needed) { | 584 bool show_ime_if_needed) { |
| 567 JNIEnv* env = AttachCurrentThread(); | 585 JNIEnv* env = AttachCurrentThread(); |
| 568 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 586 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 724 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
| 707 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 725 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
| 708 return false; | 726 return false; |
| 709 } | 727 } |
| 710 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 728 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
| 711 | 729 |
| 712 return RegisterNativesImpl(env) >= 0; | 730 return RegisterNativesImpl(env) >= 0; |
| 713 } | 731 } |
| 714 | 732 |
| 715 } // namespace content | 733 } // namespace content |
| OLD | NEW |