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

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

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 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 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/platform/WebGestureEvent.h" 10 #include "third_party/WebKit/public/platform/WebGestureEvent.h"
11 11
12 namespace blimp { 12 namespace blimp {
13 namespace { 13 namespace {
14 14
15 std::unique_ptr<blink::WebGestureEvent> BuildCommonWebGesture( 15 std::unique_ptr<blink::WebGestureEvent> BuildCommonWebGesture(
16 const InputMessage& proto, 16 const InputMessage& proto,
17 blink::WebInputEvent::Type type) { 17 blink::WebInputEvent::Type type) {
18 std::unique_ptr<blink::WebGestureEvent> event(new blink::WebGestureEvent); 18 std::unique_ptr<blink::WebGestureEvent> event(new blink::WebGestureEvent(
19 event->type = type; 19 type, blink::WebInputEvent::NoModifiers, proto.timestamp_seconds()));
20 event->timeStampSeconds = proto.timestamp_seconds();
21 20
22 const GestureCommon& common = proto.gesture_common(); 21 const GestureCommon& common = proto.gesture_common();
23 event->x = common.x(); 22 event->x = common.x();
24 event->y = common.y(); 23 event->y = common.y();
25 event->globalX = common.global_x(); 24 event->globalX = common.global_x();
26 event->globalY = common.global_y(); 25 event->globalY = common.global_y();
27 event->sourceDevice = blink::WebGestureDevice::WebGestureDeviceTouchscreen; 26 event->sourceDevice = blink::WebGestureDevice::WebGestureDeviceTouchscreen;
28 return event; 27 return event;
29 } 28 }
30 29
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return ImeMessage_InputType_TEXT_AREA; 305 return ImeMessage_InputType_TEXT_AREA;
307 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE: 306 case ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE:
308 return ImeMessage_InputType_CONTENT_EDITABLE; 307 return ImeMessage_InputType_CONTENT_EDITABLE;
309 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD: 308 case ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD:
310 return ImeMessage_InputType_DATE_TIME_FIELD; 309 return ImeMessage_InputType_DATE_TIME_FIELD;
311 } 310 }
312 return ImeMessage_InputType_NONE; 311 return ImeMessage_InputType_NONE;
313 } 312 }
314 313
315 } // namespace blimp 314 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698