| OLD | NEW |
| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 p.gesture_params())); | 69 p.gesture_params())); |
| 70 break; | 70 break; |
| 71 case content::SyntheticGestureParams::PINCH_GESTURE: | 71 case content::SyntheticGestureParams::PINCH_GESTURE: |
| 72 WriteParam(m, *content::SyntheticPinchGestureParams::Cast( | 72 WriteParam(m, *content::SyntheticPinchGestureParams::Cast( |
| 73 p.gesture_params())); | 73 p.gesture_params())); |
| 74 break; | 74 break; |
| 75 case content::SyntheticGestureParams::TAP_GESTURE: | 75 case content::SyntheticGestureParams::TAP_GESTURE: |
| 76 WriteParam(m, *content::SyntheticTapGestureParams::Cast( | 76 WriteParam(m, *content::SyntheticTapGestureParams::Cast( |
| 77 p.gesture_params())); | 77 p.gesture_params())); |
| 78 break; | 78 break; |
| 79 case content::SyntheticGestureParams::POINTER_ACTION: |
| 80 WriteParam( |
| 81 m, *content::SyntheticPointerActionParams::Cast(p.gesture_params())); |
| 82 break; |
| 79 } | 83 } |
| 80 } | 84 } |
| 81 | 85 |
| 82 bool ParamTraits<content::SyntheticGesturePacket>::Read( | 86 bool ParamTraits<content::SyntheticGesturePacket>::Read( |
| 83 const Message* m, | 87 const Message* m, |
| 84 base::PickleIterator* iter, | 88 base::PickleIterator* iter, |
| 85 param_type* p) { | 89 param_type* p) { |
| 86 content::SyntheticGestureParams::GestureType gesture_type; | 90 content::SyntheticGestureParams::GestureType gesture_type; |
| 87 if (!ReadParam(m, iter, &gesture_type)) | 91 if (!ReadParam(m, iter, &gesture_type)) |
| 88 return false; | 92 return false; |
| 89 scoped_ptr<content::SyntheticGestureParams> gesture_params; | 93 scoped_ptr<content::SyntheticGestureParams> gesture_params; |
| 90 switch (gesture_type) { | 94 switch (gesture_type) { |
| 91 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: | 95 case content::SyntheticGestureParams::SMOOTH_SCROLL_GESTURE: |
| 92 gesture_params = | 96 gesture_params = |
| 93 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m, | 97 ReadGestureParams<content::SyntheticSmoothScrollGestureParams>(m, |
| 94 iter); | 98 iter); |
| 95 break; | 99 break; |
| 96 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE: | 100 case content::SyntheticGestureParams::SMOOTH_DRAG_GESTURE: |
| 97 gesture_params = | 101 gesture_params = |
| 98 ReadGestureParams<content::SyntheticSmoothDragGestureParams>(m, iter); | 102 ReadGestureParams<content::SyntheticSmoothDragGestureParams>(m, iter); |
| 99 break; | 103 break; |
| 100 case content::SyntheticGestureParams::PINCH_GESTURE: | 104 case content::SyntheticGestureParams::PINCH_GESTURE: |
| 101 gesture_params = | 105 gesture_params = |
| 102 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter); | 106 ReadGestureParams<content::SyntheticPinchGestureParams>(m, iter); |
| 103 break; | 107 break; |
| 104 case content::SyntheticGestureParams::TAP_GESTURE: | 108 case content::SyntheticGestureParams::TAP_GESTURE: |
| 105 gesture_params = | 109 gesture_params = |
| 106 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter); | 110 ReadGestureParams<content::SyntheticTapGestureParams>(m, iter); |
| 107 break; | 111 break; |
| 112 case content::SyntheticGestureParams::POINTER_ACTION: |
| 113 gesture_params = |
| 114 ReadGestureParams<content::SyntheticPointerActionParams>(m, iter); |
| 115 break; |
| 108 default: | 116 default: |
| 109 return false; | 117 return false; |
| 110 } | 118 } |
| 111 | 119 |
| 112 p->set_gesture_params(std::move(gesture_params)); | 120 p->set_gesture_params(std::move(gesture_params)); |
| 113 return p->gesture_params() != NULL; | 121 return p->gesture_params() != NULL; |
| 114 } | 122 } |
| 115 | 123 |
| 116 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p, | 124 void ParamTraits<content::SyntheticGesturePacket>::Log(const param_type& p, |
| 117 std::string* l) { | 125 std::string* l) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 case content::SyntheticGestureParams::PINCH_GESTURE: | 139 case content::SyntheticGestureParams::PINCH_GESTURE: |
| 132 LogParam( | 140 LogParam( |
| 133 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()), | 141 *content::SyntheticPinchGestureParams::Cast(p.gesture_params()), |
| 134 l); | 142 l); |
| 135 break; | 143 break; |
| 136 case content::SyntheticGestureParams::TAP_GESTURE: | 144 case content::SyntheticGestureParams::TAP_GESTURE: |
| 137 LogParam( | 145 LogParam( |
| 138 *content::SyntheticTapGestureParams::Cast(p.gesture_params()), | 146 *content::SyntheticTapGestureParams::Cast(p.gesture_params()), |
| 139 l); | 147 l); |
| 140 break; | 148 break; |
| 149 case content::SyntheticGestureParams::POINTER_ACTION: |
| 150 LogParam(*content::SyntheticPointerActionParams::Cast(p.gesture_params()), |
| 151 l); |
| 152 break; |
| 141 } | 153 } |
| 142 } | 154 } |
| 143 | 155 |
| 144 } // namespace IPC | 156 } // namespace IPC |
| OLD | NEW |