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

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

Issue 1707943002: Add SyntheticPointerActionParams used in Chromedriver extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit to constructor Created 4 years, 8 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 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 <utility> 7 #include <utility>
8 8
9 #include "content/common/content_param_traits.h" 9 #include "content/common/content_param_traits.h"
10 #include "content/common/input/synthetic_pinch_gesture_params.h" 10 #include "content/common/input/synthetic_pinch_gesture_params.h"
11 #include "content/common/input/synthetic_pointer_action_params.h"
11 #include "content/common/input/synthetic_smooth_drag_gesture_params.h" 12 #include "content/common/input/synthetic_smooth_drag_gesture_params.h"
12 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" 13 #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
13 #include "content/common/input/web_input_event_traits.h" 14 #include "content/common/input/web_input_event_traits.h"
14 #include "content/common/input_messages.h" 15 #include "content/common/input_messages.h"
15 16
16 namespace IPC { 17 namespace IPC {
17 namespace { 18 namespace {
18 template <typename GestureType> 19 template <typename GestureType>
19 scoped_ptr<content::SyntheticGestureParams> ReadGestureParams( 20 scoped_ptr<content::SyntheticGestureParams> ReadGestureParams(
20 const base::Pickle* m, 21 const base::Pickle* m,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 p.gesture_params())); 70 p.gesture_params()));
70 break; 71 break;
71 case content::SyntheticGestureParams::PINCH_GESTURE: 72 case content::SyntheticGestureParams::PINCH_GESTURE:
72 WriteParam(m, *content::SyntheticPinchGestureParams::Cast( 73 WriteParam(m, *content::SyntheticPinchGestureParams::Cast(
73 p.gesture_params())); 74 p.gesture_params()));
74 break; 75 break;
75 case content::SyntheticGestureParams::TAP_GESTURE: 76 case content::SyntheticGestureParams::TAP_GESTURE:
76 WriteParam(m, *content::SyntheticTapGestureParams::Cast( 77 WriteParam(m, *content::SyntheticTapGestureParams::Cast(
77 p.gesture_params())); 78 p.gesture_params()));
78 break; 79 break;
80 case content::SyntheticGestureParams::POINTER_ACTION:
81 WriteParam(
82 m, *content::SyntheticPointerActionParams::Cast(p.gesture_params()));
83 break;
79 } 84 }
80 } 85 }
81 86
82 bool ParamTraits<content::SyntheticGesturePacket>::Read( 87 bool ParamTraits<content::SyntheticGesturePacket>::Read(
83 const base::Pickle* m, 88 const base::Pickle* m,
84 base::PickleIterator* iter, 89 base::PickleIterator* iter,
85 param_type* p) { 90 param_type* p) {
86 content::SyntheticGestureParams::GestureType gesture_type; 91 content::SyntheticGestureParams::GestureType gesture_type;
87 if (!ReadParam(m, iter, &gesture_type)) 92 if (!ReadParam(m, iter, &gesture_type))
88 return false; 93 return false;
89 scoped_ptr<content::SyntheticGestureParams> gesture_params; 94 scoped_ptr<content::SyntheticGestureParams> gesture_params;
90 switch (gesture_type) { 95 switch (gesture_type) {
91 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: 96 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE:
92 gesture_params = 97 gesture_params =
93 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m, 98 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m,
94 iter); 99 iter);
95 break; 100 break;
96 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE: 101 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE:
97 gesture_params = 102 gesture_params =
98 ReadGestureParams<content::SyntheticSmoothDragGestureParams>(m, iter); 103 ReadGestureParams<content::SyntheticSmoothDragGestureParams>(m, iter);
99 break; 104 break;
100 case content::SyntheticGestureParams::PINCH_GESTURE: 105 case content::SyntheticGestureParams::PINCH_GESTURE:
101 gesture_params = 106 gesture_params =
102 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter); 107 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter);
103 break; 108 break;
104 case content::SyntheticGestureParams::TAP_GESTURE: 109 case content::SyntheticGestureParams::TAP_GESTURE:
105 gesture_params = 110 gesture_params =
106 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter); 111 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter);
107 break; 112 break;
113 case content::SyntheticGestureParams::POINTER_ACTION: {
114 gesture_params =
115 ReadGestureParams<content::SyntheticPointerActionParams>(m, iter);
116 break;
117 }
108 default: 118 default:
109 return false; 119 return false;
110 } 120 }
111 121
112 p->set_gesture_params(std::move(gesture_params)); 122 p->set_gesture_params(std::move(gesture_params));
113 return p->gesture_params() != NULL; 123 return p->gesture_params() != NULL;
114 } 124 }
115 125
116 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p, 126 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p,
117 std::string* l) { 127 std::string* l) {
(...skipping 13 matching lines...) Expand all
131 case content::SyntheticGestureParams::PINCH_GESTURE: 141 case content::SyntheticGestureParams::PINCH_GESTURE:
132 LogParam( 142 LogParam(
133 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()), 143 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()),
134 l); 144 l);
135 break; 145 break;
136 case content::SyntheticGestureParams::TAP_GESTURE: 146 case content::SyntheticGestureParams::TAP_GESTURE:
137 LogParam( 147 LogParam(
138 *content::SyntheticTapGestureParams::Cast(p.gesture_params()), 148 *content::SyntheticTapGestureParams::Cast(p.gesture_params()),
139 l); 149 l);
140 break; 150 break;
151 case content::SyntheticGestureParams::POINTER_ACTION:
152 LogParam(*content::SyntheticPointerActionParams::Cast(p.gesture_params()),
153 l);
154 break;
141 } 155 }
142 } 156 }
143 157
144 } // namespace IPC 158 } // namespace IPC
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/synthetic_pointer_action.cc ('k') | content/common/input/input_param_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698