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

Side by Side Diff: content/common/input/input_param_traits.cc

Issue 942133002: Adding synthetic touch/mouse drag [Part2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mousedrag
Patch Set: Created 5 years, 10 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 | « no previous file | content/common/input_messages.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/input_param_traits.h" 5 #include "content/common/input/input_param_traits.h"
6 6
7 #include "content/common/content_param_traits.h" 7 #include "content/common/content_param_traits.h"
8 #include "content/common/input/synthetic_pinch_gesture_params.h" 8 #include "content/common/input/synthetic_pinch_gesture_params.h"
9 #include "content/common/input/synthetic_smooth_drag_gesture_params.h"
9 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" 10 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
10 #include "content/common/input/web_input_event_traits.h" 11 #include "content/common/input/web_input_event_traits.h"
11 #include "content/common/input_messages.h" 12 #include "content/common/input_messages.h"
12 13
13 namespace IPC { 14 namespace IPC {
14 namespace { 15 namespace {
15 template<typename GestureType> 16 template<typename GestureType>
16 scoped_ptr<content::SyntheticGestureParams> ReadGestureParams( 17 scoped_ptr<content::SyntheticGestureParams> ReadGestureParams(
17 const Message* m, 18 const Message* m,
18 PickleIterator* iter) 19 PickleIterator* iter)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 56
56 void ParamTraits<content::SyntheticGesturePacket>::Write(Message* m, 57 void ParamTraits<content::SyntheticGesturePacket>::Write(Message* m,
57 const param_type& p) { 58 const param_type& p) {
58 DCHECK(p.gesture_params()); 59 DCHECK(p.gesture_params());
59 WriteParam(m, p.gesture_params()->GetGestureType()); 60 WriteParam(m, p.gesture_params()->GetGestureType());
60 switch (p.gesture_params()->GetGestureType()) { 61 switch (p.gesture_params()->GetGestureType()) {
61 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: 62 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE:
62 WriteParam(m, *content::SyntheticSmoothScrollGestureParams::Cast( 63 WriteParam(m, *content::SyntheticSmoothScrollGestureParams::Cast(
63 p.gesture_params())); 64 p.gesture_params()));
64 break; 65 break;
66 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
67 WriteParam(m, *content::SyntheticSmoothDragGestureParams::Cast(
68 p.gesture_params()));
petrcermak 2015/02/20 18:00:32 This line shouldn't be indented so much (look at t
69 break;
65 case content::SyntheticGestureParams::PINCH_GESTURE: 70 case content::SyntheticGestureParams::PINCH_GESTURE:
66 WriteParam(m, *content::SyntheticPinchGestureParams::Cast( 71 WriteParam(m, *content::SyntheticPinchGestureParams::Cast(
67 p.gesture_params())); 72 p.gesture_params()));
68 break; 73 break;
69 case content::SyntheticGestureParams::TAP_GESTURE: 74 case content::SyntheticGestureParams::TAP_GESTURE:
70 WriteParam(m, *content::SyntheticTapGestureParams::Cast( 75 WriteParam(m, *content::SyntheticTapGestureParams::Cast(
71 p.gesture_params())); 76 p.gesture_params()));
72 break; 77 break;
73 // TODO(ssid): When API and IPC messages are set up, implement this.
74 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
75 NOTIMPLEMENTED();
76 break;
77 } 78 }
78 } 79 }
79 80
80 bool ParamTraits<content::SyntheticGesturePacket>::Read(const Message* m, 81 bool ParamTraits<content::SyntheticGesturePacket>::Read(const Message* m,
81 PickleIterator* iter, 82 PickleIterator* iter,
82 param_type* p) { 83 param_type* p) {
83 content::SyntheticGestureParams::GestureType gesture_type; 84 content::SyntheticGestureParams::GestureType gesture_type;
84 if (!ReadParam(m, iter, &gesture_type)) 85 if (!ReadParam(m, iter, &gesture_type))
85 return false; 86 return false;
86 scoped_ptr<content::SyntheticGestureParams> gesture_params; 87 scoped_ptr<content::SyntheticGestureParams> gesture_params;
87 switch (gesture_type) { 88 switch (gesture_type) {
88 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: 89 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE:
89 gesture_params = 90 gesture_params =
90 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m, 91 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m,
91 iter); 92 iter);
92 break; 93 break;
94 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
95 gesture_params =
96 ReadGestureParams<content::SyntheticSmoothDragGestureParams>(m, iter);
97 break;
93 case content::SyntheticGestureParams::PINCH_GESTURE: 98 case content::SyntheticGestureParams::PINCH_GESTURE:
94 gesture_params = 99 gesture_params =
95 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter); 100 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter);
96 break; 101 break;
97 case content::SyntheticGestureParams::TAP_GESTURE: 102 case content::SyntheticGestureParams::TAP_GESTURE:
98 gesture_params = 103 gesture_params =
99 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter); 104 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter);
100 break; 105 break;
101 default: 106 default:
102 return false; 107 return false;
103 } 108 }
104 109
105 p->set_gesture_params(gesture_params.Pass()); 110 p->set_gesture_params(gesture_params.Pass());
106 return p->gesture_params() != NULL; 111 return p->gesture_params() != NULL;
107 } 112 }
108 113
109 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p, 114 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p,
110 std::string* l) { 115 std::string* l) {
111 DCHECK(p.gesture_params()); 116 DCHECK(p.gesture_params());
112 switch (p.gesture_params()->GetGestureType()) { 117 switch (p.gesture_params()->GetGestureType()) {
113 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: 118 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE:
114 LogParam( 119 LogParam(
115 *content::SyntheticSmoothScrollGestureParams::Cast( 120 *content::SyntheticSmoothScrollGestureParams::Cast(
116 p.gesture_params()), 121 p.gesture_params()),
117 l); 122 l);
118 break; 123 break;
124 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
125 LogParam(
126 *content::SyntheticSmoothDragGestureParams::Cast(p.gesture_params()),
127 l);
128 break;
119 case content::SyntheticGestureParams::PINCH_GESTURE: 129 case content::SyntheticGestureParams::PINCH_GESTURE:
120 LogParam( 130 LogParam(
121 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()), 131 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()),
122 l); 132 l);
123 break; 133 break;
124 case content::SyntheticGestureParams::TAP_GESTURE: 134 case content::SyntheticGestureParams::TAP_GESTURE:
125 LogParam( 135 LogParam(
126 *content::SyntheticTapGestureParams::Cast(p.gesture_params()), 136 *content::SyntheticTapGestureParams::Cast(p.gesture_params()),
127 l); 137 l);
128 break; 138 break;
129 // TODO(ssid): When API and IPC messages are set up, implement this.
130 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
131 NOTIMPLEMENTED();
132 break;
133 } 139 }
134 } 140 }
135 141
136 } // namespace IPC 142 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | content/common/input_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698