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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 335 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
336 if (obj.is_null()) | 336 if (obj.is_null()) |
337 return false; | 337 return false; |
338 return Java_ContentViewCore_hasFocus(env, obj.obj()); | 338 return Java_ContentViewCore_hasFocus(env, obj.obj()); |
339 } | 339 } |
340 | 340 |
341 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | 341 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
342 NOTIMPLEMENTED() << "not upstreamed yet"; | 342 NOTIMPLEMENTED() << "not upstreamed yet"; |
343 } | 343 } |
344 | 344 |
| 345 void ContentViewCoreImpl::ShowPastePopup(int x, int y) { |
| 346 JNIEnv* env = AttachCurrentThread(); |
| 347 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 348 if (obj.is_null()) |
| 349 return; |
| 350 Java_ContentViewCore_showPastePopup(env, obj.obj(), static_cast<jint>(x), |
| 351 static_cast<jint>(y)); |
| 352 } |
| 353 |
345 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 354 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
346 JNIEnv* env = AttachCurrentThread(); | 355 JNIEnv* env = AttachCurrentThread(); |
347 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 356 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
348 if (j_obj.is_null()) | 357 if (j_obj.is_null()) |
349 return; | 358 return; |
350 ScopedJavaLocalRef<jstring> jcontent_url = | 359 ScopedJavaLocalRef<jstring> jcontent_url = |
351 ConvertUTF8ToJavaString(env, content_url.spec()); | 360 ConvertUTF8ToJavaString(env, content_url.spec()); |
352 Java_ContentViewCore_startContentIntent(env, | 361 Java_ContentViewCore_startContentIntent(env, |
353 j_obj.obj(), | 362 j_obj.obj(), |
354 jcontent_url.obj()); | 363 jcontent_url.obj()); |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 935 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
927 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 936 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
928 return false; | 937 return false; |
929 } | 938 } |
930 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 939 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
931 | 940 |
932 return RegisterNativesImpl(env) >= 0; | 941 return RegisterNativesImpl(env) >= 0; |
933 } | 942 } |
934 | 943 |
935 } // namespace content | 944 } // namespace content |
OLD | NEW |