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