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

Side by Side Diff: blimp/net/input_message_converter.cc

Issue 1975213003: Blimp Client: add support for tap gesture events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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
« no previous file with comments | « blimp/engine/session/blimp_engine_session.cc ('k') | blimp/net/input_message_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/net/input_message_converter.h" 5 #include "blimp/net/input_message_converter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "blimp/common/proto/input.pb.h" 8 #include "blimp/common/proto/input.pb.h"
9 #include "third_party/WebKit/public/platform/WebGestureDevice.h" 9 #include "third_party/WebKit/public/platform/WebGestureDevice.h"
10 #include "third_party/WebKit/public/web/WebInputEvent.h" 10 #include "third_party/WebKit/public/web/WebInputEvent.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture( 119 std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
120 proto, blink::WebInputEvent::Type::GesturePinchUpdate)); 120 proto, blink::WebInputEvent::Type::GesturePinchUpdate));
121 121
122 const GesturePinchUpdate& details = proto.gesture_pinch_update(); 122 const GesturePinchUpdate& details = proto.gesture_pinch_update();
123 event->data.pinchUpdate.zoomDisabled = details.zoom_disabled(); 123 event->data.pinchUpdate.zoomDisabled = details.zoom_disabled();
124 event->data.pinchUpdate.scale = details.scale(); 124 event->data.pinchUpdate.scale = details.scale();
125 125
126 return event; 126 return event;
127 } 127 }
128 128
129 std::unique_ptr<blink::WebGestureEvent> ProtoToGestureTapDown(
130 const InputMessage& proto) {
131 std::unique_ptr<blink::WebGestureEvent> event(
132 BuildCommonWebGesture(proto, blink::WebInputEvent::Type::GestureTapDown));
133
134 const GestureTapDown& details = proto.gesture_tap_down();
135 event->data.tapDown.width = details.width();
136 event->data.tapDown.height = details.height();
137
138 return event;
139 }
140
141 std::unique_ptr<blink::WebGestureEvent> ProtoToGestureTapCancel(
142 const InputMessage& proto) {
143 return BuildCommonWebGesture(proto,
144 blink::WebInputEvent::Type::GestureTapCancel);
145 }
146
147 std::unique_ptr<blink::WebGestureEvent> ProtoToGestureTapUnconfirmed(
148 const InputMessage& proto) {
149 std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
150 proto, blink::WebInputEvent::Type::GestureTapUnconfirmed));
151
152 const GestureTap& details = proto.gesture_tap();
153 event->data.tap.tapCount = details.tap_count();
154 event->data.tap.width = details.width();
155 event->data.tap.height = details.height();
156
157 return event;
158 }
159
160 std::unique_ptr<blink::WebGestureEvent> ProtoToGestureShowPress(
161 const InputMessage& proto) {
162 std::unique_ptr<blink::WebGestureEvent> event(BuildCommonWebGesture(
163 proto, blink::WebInputEvent::Type::GestureShowPress));
164
165 const GestureShowPress& details = proto.gesture_show_press();
166 event->data.showPress.width = details.width();
167 event->data.showPress.height = details.height();
168
169 return event;
170 }
171
129 } // namespace 172 } // namespace
130 173
131 InputMessageConverter::InputMessageConverter() {} 174 InputMessageConverter::InputMessageConverter() {}
132 175
133 InputMessageConverter::~InputMessageConverter() {} 176 InputMessageConverter::~InputMessageConverter() {}
134 177
135 std::unique_ptr<blink::WebGestureEvent> InputMessageConverter::ProcessMessage( 178 std::unique_ptr<blink::WebGestureEvent> InputMessageConverter::ProcessMessage(
136 const InputMessage& message) { 179 const InputMessage& message) {
137 std::unique_ptr<blink::WebGestureEvent> event; 180 std::unique_ptr<blink::WebGestureEvent> event;
138 181
(...skipping 18 matching lines...) Expand all
157 break; 200 break;
158 case InputMessage::Type_GesturePinchBegin: 201 case InputMessage::Type_GesturePinchBegin:
159 event = ProtoToGesturePinchBegin(message); 202 event = ProtoToGesturePinchBegin(message);
160 break; 203 break;
161 case InputMessage::Type_GesturePinchEnd: 204 case InputMessage::Type_GesturePinchEnd:
162 event = ProtoToGesturePinchEnd(message); 205 event = ProtoToGesturePinchEnd(message);
163 break; 206 break;
164 case InputMessage::Type_GesturePinchUpdate: 207 case InputMessage::Type_GesturePinchUpdate:
165 event = ProtoToGesturePinchUpdate(message); 208 event = ProtoToGesturePinchUpdate(message);
166 break; 209 break;
210 case InputMessage::Type_GestureTapDown:
211 event = ProtoToGestureTapDown(message);
212 break;
213 case InputMessage::Type_GestureTapCancel:
214 event = ProtoToGestureTapCancel(message);
215 break;
216 case InputMessage::Type_GestureTapUnconfirmed:
217 event = ProtoToGestureTapUnconfirmed(message);
218 break;
219 case InputMessage::Type_GestureShowPress:
220 event = ProtoToGestureShowPress(message);
221 break;
167 case InputMessage::UNKNOWN: 222 case InputMessage::UNKNOWN:
168 DLOG(FATAL) << "Received an InputMessage with an unknown type."; 223 DLOG(FATAL) << "Received an InputMessage with an unknown type.";
169 return nullptr; 224 return nullptr;
170 } 225 }
171 226
172 return event; 227 return event;
173 } 228 }
174 229
175 ui::TextInputType InputMessageConverter::TextInputTypeFromProto( 230 ui::TextInputType InputMessageConverter::TextInputTypeFromProto(
176 ImeMessage_InputType type) { 231 ImeMessage_InputType type) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 return ImeMessage_InputType_TEXT_AREA; 304 return ImeMessage_InputType_TEXT_AREA;
250 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE: 305 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE:
251 return ImeMessage_InputType_CONTENT_EDITABLE; 306 return ImeMessage_InputType_CONTENT_EDITABLE;
252 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD: 307 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD:
253 return ImeMessage_InputType_DATE_TIME_FIELD; 308 return ImeMessage_InputType_DATE_TIME_FIELD;
254 } 309 }
255 return ImeMessage_InputType_NONE; 310 return ImeMessage_InputType_NONE;
256 } 311 }
257 312
258 } // namespace blimp 313 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/session/blimp_engine_session.cc ('k') | blimp/net/input_message_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698