Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 2792063003: Factor out RenderWidgetHostConnector (Closed)
Patch Set: format Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 return Java_ContentViewCore_hasFocus(env, obj); 587 return Java_ContentViewCore_hasFocus(env, obj);
588 } 588 }
589 589
590 void ContentViewCoreImpl::RequestDisallowInterceptTouchEvent() { 590 void ContentViewCoreImpl::RequestDisallowInterceptTouchEvent() {
591 JNIEnv* env = AttachCurrentThread(); 591 JNIEnv* env = AttachCurrentThread();
592 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 592 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
593 if (!obj.is_null()) 593 if (!obj.is_null())
594 Java_ContentViewCore_requestDisallowInterceptTouchEvent(env, obj); 594 Java_ContentViewCore_requestDisallowInterceptTouchEvent(env, obj);
595 } 595 }
596 596
597 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) {
598 JNIEnv* env = AttachCurrentThread();
599 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
600 if (obj.is_null())
601 return;
602 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text);
603 Java_ContentViewCore_onSelectionChanged(env, obj, jtext);
604 }
605
606 void ContentViewCoreImpl::OnSelectionEvent(ui::SelectionEventType event,
607 const gfx::PointF& selection_anchor,
608 const gfx::RectF& selection_rect) {
609 JNIEnv* env = AttachCurrentThread();
610 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
611 if (j_obj.is_null())
612 return;
613
614 Java_ContentViewCore_onSelectionEvent(
615 env, j_obj, event, selection_anchor.x(), selection_anchor.y(),
616 selection_rect.x(), selection_rect.y(), selection_rect.right(),
617 selection_rect.bottom());
618 }
619
620 bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) { 597 bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) {
621 // Display paste pop-up only when selection is empty and editable. 598 // Display paste pop-up only when selection is empty and editable.
622 if (!(params.is_editable && params.selection_text.empty())) 599 if (!(params.is_editable && params.selection_text.empty()))
623 return false; 600 return false;
624 601
625 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 602 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
626 if (!view) 603 if (!view)
627 return false; 604 return false;
628 605
629 JNIEnv* env = AttachCurrentThread(); 606 JNIEnv* env = AttachCurrentThread();
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 return ScopedJavaLocalRef<jobject>(); 1301 return ScopedJavaLocalRef<jobject>();
1325 1302
1326 return view->GetJavaObject(); 1303 return view->GetJavaObject();
1327 } 1304 }
1328 1305
1329 bool RegisterContentViewCore(JNIEnv* env) { 1306 bool RegisterContentViewCore(JNIEnv* env) {
1330 return RegisterNativesImpl(env); 1307 return RegisterNativesImpl(env);
1331 } 1308 }
1332 1309
1333 } // namespace content 1310 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698