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 "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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 using base::android::ConvertJavaStringToUTF8; | 63 using base::android::ConvertJavaStringToUTF8; |
64 using base::android::ConvertUTF16ToJavaString; | 64 using base::android::ConvertUTF16ToJavaString; |
65 using base::android::ConvertUTF8ToJavaString; | 65 using base::android::ConvertUTF8ToJavaString; |
66 using base::android::ScopedJavaLocalRef; | 66 using base::android::ScopedJavaLocalRef; |
67 using blink::WebGestureEvent; | 67 using blink::WebGestureEvent; |
68 using blink::WebInputEvent; | 68 using blink::WebInputEvent; |
69 | 69 |
70 // Describes the type and enabled state of a select popup item. | 70 // Describes the type and enabled state of a select popup item. |
71 namespace { | 71 namespace { |
72 | 72 |
73 enum { | 73 // A Java counterpart will be generated for this enum. |
74 #define DEFINE_POPUP_ITEM_TYPE(name, value) POPUP_ITEM_TYPE_##name = value, | 74 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser.input |
75 #include "content/browser/android/popup_item_type_list.h" | 75 enum PopupItemType { |
76 #undef DEFINE_POPUP_ITEM_TYPE | 76 // Popup item is of type group |
| 77 POPUP_ITEM_TYPE_GROUP, |
| 78 |
| 79 // Popup item is disabled |
| 80 POPUP_ITEM_TYPE_DISABLED, |
| 81 |
| 82 // Popup item is enabled |
| 83 POPUP_ITEM_TYPE_ENABLED, |
77 }; | 84 }; |
78 | 85 |
79 } //namespace | 86 } //namespace |
80 | 87 |
81 namespace content { | 88 namespace content { |
82 | 89 |
83 namespace { | 90 namespace { |
84 | 91 |
85 const void* kContentViewUserDataKey = &kContentViewUserDataKey; | 92 const void* kContentViewUserDataKey = &kContentViewUserDataKey; |
86 | 93 |
(...skipping 14 matching lines...) Expand all Loading... |
101 Java_ContentViewCore_createRect(env, | 108 Java_ContentViewCore_createRect(env, |
102 static_cast<int>(rect.x()), | 109 static_cast<int>(rect.x()), |
103 static_cast<int>(rect.y()), | 110 static_cast<int>(rect.y()), |
104 static_cast<int>(rect.right()), | 111 static_cast<int>(rect.right()), |
105 static_cast<int>(rect.bottom()))); | 112 static_cast<int>(rect.bottom()))); |
106 } | 113 } |
107 | 114 |
108 int ToGestureEventType(WebInputEvent::Type type) { | 115 int ToGestureEventType(WebInputEvent::Type type) { |
109 switch (type) { | 116 switch (type) { |
110 case WebInputEvent::GestureScrollBegin: | 117 case WebInputEvent::GestureScrollBegin: |
111 return SCROLL_START; | 118 return GESTURE_EVENT_TYPE_SCROLL_START; |
112 case WebInputEvent::GestureScrollEnd: | 119 case WebInputEvent::GestureScrollEnd: |
113 return SCROLL_END; | 120 return GESTURE_EVENT_TYPE_SCROLL_END; |
114 case WebInputEvent::GestureScrollUpdate: | 121 case WebInputEvent::GestureScrollUpdate: |
115 return SCROLL_BY; | 122 return GESTURE_EVENT_TYPE_SCROLL_BY; |
116 case WebInputEvent::GestureFlingStart: | 123 case WebInputEvent::GestureFlingStart: |
117 return FLING_START; | 124 return GESTURE_EVENT_TYPE_FLING_START; |
118 case WebInputEvent::GestureFlingCancel: | 125 case WebInputEvent::GestureFlingCancel: |
119 return FLING_CANCEL; | 126 return GESTURE_EVENT_TYPE_FLING_CANCEL; |
120 case WebInputEvent::GestureShowPress: | 127 case WebInputEvent::GestureShowPress: |
121 return SHOW_PRESS; | 128 return GESTURE_EVENT_TYPE_SHOW_PRESS; |
122 case WebInputEvent::GestureTap: | 129 case WebInputEvent::GestureTap: |
123 return SINGLE_TAP_CONFIRMED; | 130 return GESTURE_EVENT_TYPE_SINGLE_TAP_CONFIRMED; |
124 case WebInputEvent::GestureTapUnconfirmed: | 131 case WebInputEvent::GestureTapUnconfirmed: |
125 return SINGLE_TAP_UNCONFIRMED; | 132 return GESTURE_EVENT_TYPE_SINGLE_TAP_UNCONFIRMED; |
126 case WebInputEvent::GestureTapDown: | 133 case WebInputEvent::GestureTapDown: |
127 return TAP_DOWN; | 134 return GESTURE_EVENT_TYPE_TAP_DOWN; |
128 case WebInputEvent::GestureTapCancel: | 135 case WebInputEvent::GestureTapCancel: |
129 return TAP_CANCEL; | 136 return GESTURE_EVENT_TYPE_TAP_CANCEL; |
130 case WebInputEvent::GestureDoubleTap: | 137 case WebInputEvent::GestureDoubleTap: |
131 return DOUBLE_TAP; | 138 return GESTURE_EVENT_TYPE_DOUBLE_TAP; |
132 case WebInputEvent::GestureLongPress: | 139 case WebInputEvent::GestureLongPress: |
133 return LONG_PRESS; | 140 return GESTURE_EVENT_TYPE_LONG_PRESS; |
134 case WebInputEvent::GestureLongTap: | 141 case WebInputEvent::GestureLongTap: |
135 return LONG_TAP; | 142 return GESTURE_EVENT_TYPE_LONG_TAP; |
136 case WebInputEvent::GesturePinchBegin: | 143 case WebInputEvent::GesturePinchBegin: |
137 return PINCH_BEGIN; | 144 return GESTURE_EVENT_TYPE_PINCH_BEGIN; |
138 case WebInputEvent::GesturePinchEnd: | 145 case WebInputEvent::GesturePinchEnd: |
139 return PINCH_END; | 146 return GESTURE_EVENT_TYPE_PINCH_END; |
140 case WebInputEvent::GesturePinchUpdate: | 147 case WebInputEvent::GesturePinchUpdate: |
141 return PINCH_BY; | 148 return GESTURE_EVENT_TYPE_PINCH_BY; |
142 case WebInputEvent::GestureTwoFingerTap: | 149 case WebInputEvent::GestureTwoFingerTap: |
143 case WebInputEvent::GestureScrollUpdateWithoutPropagation: | 150 case WebInputEvent::GestureScrollUpdateWithoutPropagation: |
144 default: | 151 default: |
145 NOTREACHED() << "Invalid source gesture type: " | 152 NOTREACHED() << "Invalid source gesture type: " |
146 << WebInputEventTraits::GetName(type); | 153 << WebInputEventTraits::GetName(type); |
147 return -1; | 154 return -1; |
148 }; | 155 }; |
149 } | 156 } |
150 | 157 |
151 float GetPrimaryDisplayDeviceScaleFactor() { | 158 float GetPrimaryDisplayDeviceScaleFactor() { |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1338 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1332 retained_objects_set); | 1339 retained_objects_set); |
1333 return reinterpret_cast<intptr_t>(view); | 1340 return reinterpret_cast<intptr_t>(view); |
1334 } | 1341 } |
1335 | 1342 |
1336 bool RegisterContentViewCore(JNIEnv* env) { | 1343 bool RegisterContentViewCore(JNIEnv* env) { |
1337 return RegisterNativesImpl(env); | 1344 return RegisterNativesImpl(env); |
1338 } | 1345 } |
1339 | 1346 |
1340 } // namespace content | 1347 } // namespace content |
OLD | NEW |