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

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

Issue 1341013002: [Android] Move weak ref for PopupWindowTouchHandleDrawable to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 "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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 614
615 gfx::PointF selection_anchor_pix = 615 gfx::PointF selection_anchor_pix =
616 gfx::ScalePoint(selection_anchor, dpi_scale()); 616 gfx::ScalePoint(selection_anchor, dpi_scale());
617 gfx::RectF selection_rect_pix = gfx::ScaleRect(selection_rect, dpi_scale()); 617 gfx::RectF selection_rect_pix = gfx::ScaleRect(selection_rect, dpi_scale());
618 Java_ContentViewCore_onSelectionEvent( 618 Java_ContentViewCore_onSelectionEvent(
619 env, j_obj.obj(), event, selection_anchor_pix.x(), 619 env, j_obj.obj(), event, selection_anchor_pix.x(),
620 selection_anchor_pix.y(), selection_rect_pix.x(), selection_rect_pix.y(), 620 selection_anchor_pix.y(), selection_rect_pix.x(), selection_rect_pix.y(),
621 selection_rect_pix.right(), selection_rect_pix.bottom()); 621 selection_rect_pix.right(), selection_rect_pix.bottom());
622 } 622 }
623 623
624 scoped_ptr<ui::TouchHandleDrawable>
625 ContentViewCoreImpl::CreatePopupTouchHandleDrawable() {
626 JNIEnv* env = AttachCurrentThread();
627 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
628 if (obj.is_null()) {
629 NOTREACHED();
630 return scoped_ptr<ui::TouchHandleDrawable>();
631 }
632 return scoped_ptr<ui::TouchHandleDrawable>(new PopupTouchHandleDrawable(
633 Java_ContentViewCore_createPopupTouchHandleDrawable(env, obj.obj()),
634 dpi_scale_));
635 }
636
637 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { 624 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) {
638 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 625 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
639 if (!view) 626 if (!view)
640 return; 627 return;
641 628
642 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip)); 629 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip));
643 630
644 JNIEnv* env = AttachCurrentThread(); 631 JNIEnv* env = AttachCurrentThread();
645 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 632 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
646 if (obj.is_null()) 633 if (obj.is_null())
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 return ScopedJavaLocalRef<jobject>(); 1463 return ScopedJavaLocalRef<jobject>();
1477 1464
1478 return view->GetJavaObject(); 1465 return view->GetJavaObject();
1479 } 1466 }
1480 1467
1481 bool RegisterContentViewCore(JNIEnv* env) { 1468 bool RegisterContentViewCore(JNIEnv* env) {
1482 return RegisterNativesImpl(env); 1469 return RegisterNativesImpl(env);
1483 } 1470 }
1484 1471
1485 } // namespace content 1472 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/android/popup_touch_handle_drawable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698