OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "content/public/browser/ssl_host_state_delegate.h" | 46 #include "content/public/browser/ssl_host_state_delegate.h" |
47 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
48 #include "content/public/common/content_client.h" | 48 #include "content/public/common/content_client.h" |
49 #include "content/public/common/content_switches.h" | 49 #include "content/public/common/content_switches.h" |
50 #include "content/public/common/menu_item.h" | 50 #include "content/public/common/menu_item.h" |
51 #include "content/public/common/user_agent.h" | 51 #include "content/public/common/user_agent.h" |
52 #include "device/geolocation/geolocation_service_context.h" | 52 #include "device/geolocation/geolocation_service_context.h" |
53 #include "jni/ContentViewCore_jni.h" | 53 #include "jni/ContentViewCore_jni.h" |
54 #include "jni/DragEvent_jni.h" | 54 #include "jni/DragEvent_jni.h" |
55 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 55 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 56 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
56 #include "ui/android/view_android.h" | 57 #include "ui/android/view_android.h" |
57 #include "ui/android/window_android.h" | 58 #include "ui/android/window_android.h" |
58 #include "ui/base/clipboard/clipboard.h" | 59 #include "ui/base/clipboard/clipboard.h" |
59 #include "ui/base/ui_base_switches_util.h" | 60 #include "ui/base/ui_base_switches_util.h" |
60 #include "ui/events/android/motion_event_android.h" | 61 #include "ui/events/android/motion_event_android.h" |
61 #include "ui/events/blink/blink_event_util.h" | 62 #include "ui/events/blink/blink_event_util.h" |
62 #include "ui/events/blink/web_input_event_traits.h" | 63 #include "ui/events/blink/web_input_event_traits.h" |
63 #include "ui/events/event_utils.h" | 64 #include "ui/events/event_utils.h" |
64 #include "ui/events/gesture_detection/motion_event.h" | 65 #include "ui/events/gesture_detection/motion_event.h" |
65 #include "ui/gfx/android/java_bitmap.h" | 66 #include "ui/gfx/android/java_bitmap.h" |
66 #include "ui/gfx/geometry/point_conversions.h" | 67 #include "ui/gfx/geometry/point_conversions.h" |
67 #include "ui/gfx/geometry/size_conversions.h" | 68 #include "ui/gfx/geometry/size_conversions.h" |
68 #include "ui/gfx/geometry/size_f.h" | 69 #include "ui/gfx/geometry/size_f.h" |
69 | 70 |
70 using base::android::AttachCurrentThread; | 71 using base::android::AttachCurrentThread; |
71 using base::android::ConvertJavaStringToUTF16; | 72 using base::android::ConvertJavaStringToUTF16; |
72 using base::android::ConvertJavaStringToUTF8; | 73 using base::android::ConvertJavaStringToUTF8; |
73 using base::android::ConvertUTF16ToJavaString; | 74 using base::android::ConvertUTF16ToJavaString; |
74 using base::android::ConvertUTF8ToJavaString; | 75 using base::android::ConvertUTF8ToJavaString; |
75 using base::android::JavaParamRef; | 76 using base::android::JavaParamRef; |
76 using base::android::JavaRef; | 77 using base::android::JavaRef; |
77 using base::android::ScopedJavaLocalRef; | 78 using base::android::ScopedJavaLocalRef; |
| 79 using blink::WebContextMenuData; |
78 using blink::WebGestureEvent; | 80 using blink::WebGestureEvent; |
79 using blink::WebInputEvent; | 81 using blink::WebInputEvent; |
80 using ui::MotionEventAndroid; | 82 using ui::MotionEventAndroid; |
81 | 83 |
82 namespace content { | 84 namespace content { |
83 | 85 |
84 namespace { | 86 namespace { |
85 | 87 |
86 // Describes the type and enabled state of a select popup item. | 88 // Describes the type and enabled state of a select popup item. |
87 // | 89 // |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 return false; | 625 return false; |
624 | 626 |
625 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 627 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
626 if (!view) | 628 if (!view) |
627 return false; | 629 return false; |
628 | 630 |
629 JNIEnv* env = AttachCurrentThread(); | 631 JNIEnv* env = AttachCurrentThread(); |
630 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 632 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
631 if (obj.is_null()) | 633 if (obj.is_null()) |
632 return false; | 634 return false; |
| 635 const bool can_select_all = |
| 636 !!(params.edit_flags & WebContextMenuData::kCanSelectAll); |
633 Java_ContentViewCore_showPastePopup(env, obj, params.selection_start.x(), | 637 Java_ContentViewCore_showPastePopup(env, obj, params.selection_start.x(), |
634 params.selection_start.y()); | 638 params.selection_start.y(), |
| 639 can_select_all); |
635 return true; | 640 return true; |
636 } | 641 } |
637 | 642 |
638 void ContentViewCoreImpl::ShowDisambiguationPopup( | 643 void ContentViewCoreImpl::ShowDisambiguationPopup( |
639 const gfx::Rect& rect_pixels, | 644 const gfx::Rect& rect_pixels, |
640 const SkBitmap& zoomed_bitmap) { | 645 const SkBitmap& zoomed_bitmap) { |
641 JNIEnv* env = AttachCurrentThread(); | 646 JNIEnv* env = AttachCurrentThread(); |
642 | 647 |
643 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 648 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
644 if (obj.is_null()) | 649 if (obj.is_null()) |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 return ScopedJavaLocalRef<jobject>(); | 1351 return ScopedJavaLocalRef<jobject>(); |
1347 | 1352 |
1348 return view->GetJavaObject(); | 1353 return view->GetJavaObject(); |
1349 } | 1354 } |
1350 | 1355 |
1351 bool RegisterContentViewCore(JNIEnv* env) { | 1356 bool RegisterContentViewCore(JNIEnv* env) { |
1352 return RegisterNativesImpl(env); | 1357 return RegisterNativesImpl(env); |
1353 } | 1358 } |
1354 | 1359 |
1355 } // namespace content | 1360 } // namespace content |
OLD | NEW |