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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 324 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
325 if (obj.is_null()) | 325 if (obj.is_null()) |
326 return false; | 326 return false; |
327 return Java_ContentViewCore_hasFocus(env, obj.obj()); | 327 return Java_ContentViewCore_hasFocus(env, obj.obj()); |
328 } | 328 } |
329 | 329 |
330 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | 330 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
331 NOTIMPLEMENTED() << "not upstreamed yet"; | 331 NOTIMPLEMENTED() << "not upstreamed yet"; |
332 } | 332 } |
333 | 333 |
334 void ContentViewCoreImpl::SelectText(const string16& selected_text, | |
olilan
2012/10/01 13:01:30
This method doesn't select any text - ShowPastePop
| |
335 int selection_start_x, | |
336 int selection_start_y) { | |
337 JNIEnv* env = AttachCurrentThread(); | |
338 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
339 if (obj.is_null()) | |
340 return; | |
341 ScopedJavaLocalRef<jstring> jtext = | |
342 ConvertUTF16ToJavaString(env, selected_text); | |
343 Java_ContentViewCore_onTextSelected(env, obj.obj(), | |
344 jtext.obj(), | |
345 static_cast<jint>(selection_start_x), | |
346 static_cast<jint>(selection_start_y)); | |
347 } | |
348 | |
334 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 349 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
335 JNIEnv* env = AttachCurrentThread(); | 350 JNIEnv* env = AttachCurrentThread(); |
336 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 351 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
337 if (j_obj.is_null()) | 352 if (j_obj.is_null()) |
338 return; | 353 return; |
339 ScopedJavaLocalRef<jstring> jcontent_url = | 354 ScopedJavaLocalRef<jstring> jcontent_url = |
340 ConvertUTF8ToJavaString(env, content_url.spec()); | 355 ConvertUTF8ToJavaString(env, content_url.spec()); |
341 Java_ContentViewCore_startContentIntent(env, | 356 Java_ContentViewCore_startContentIntent(env, |
342 j_obj.obj(), | 357 j_obj.obj(), |
343 jcontent_url.obj()); | 358 jcontent_url.obj()); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
851 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 866 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
852 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 867 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
853 return false; | 868 return false; |
854 } | 869 } |
855 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 870 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
856 | 871 |
857 return RegisterNativesImpl(env) >= 0; | 872 return RegisterNativesImpl(env) >= 0; |
858 } | 873 } |
859 | 874 |
860 } // namespace content | 875 } // namespace content |
OLD | NEW |