Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/renderer/gpu/actions_parser.h" | 5 #include "content/renderer/gpu/actions_parser.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 action_index_); | 183 action_index_); |
| 184 return false; | 184 return false; |
| 185 } | 185 } |
| 186 | 186 |
| 187 if (action.HasKey("y") && !action.GetDouble("y", &position_y)) { | 187 if (action.HasKey("y") && !action.GetDouble("y", &position_y)) { |
| 188 error_message_ = base::StringPrintf("actions[%d].actions.y is not a number", | 188 error_message_ = base::StringPrintf("actions[%d].actions.y is not a number", |
| 189 action_index_); | 189 action_index_); |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 int button = 1; | |
| 194 if (action.HasKey("button") && !action.GetInteger("button", &button)) { | |
| 195 error_message_ = base::StringPrintf( | |
| 196 "actions[%d].actions.button is not a number", action_index_); | |
| 197 return false; | |
| 198 } | |
| 199 | |
| 193 SyntheticPointerActionParams action_param(pointer_action_type); | 200 SyntheticPointerActionParams action_param(pointer_action_type); |
| 194 action_param.set_index(action_index_); | 201 action_param.set_index(action_index_); |
| 195 if (pointer_action_type == | 202 switch (pointer_action_type) { |
| 196 SyntheticPointerActionParams::PointerActionType::PRESS || | 203 case SyntheticPointerActionParams::PointerActionType::PRESS: |
| 197 pointer_action_type == | 204 action_param.set_position(gfx::PointF(position_x, position_y)); |
| 198 SyntheticPointerActionParams::PointerActionType::MOVE) { | 205 action_param.set_button(button); |
| 199 action_param.set_position(gfx::PointF(position_x, position_y)); | 206 break; |
| 207 case SyntheticPointerActionParams::PointerActionType::MOVE: | |
| 208 action_param.set_position(gfx::PointF(position_x, position_y)); | |
| 209 break; | |
| 210 case SyntheticPointerActionParams::PointerActionType::RELEASE: | |
| 211 action_param.set_button(button); | |
|
Navid Zolghadr
2017/01/12 18:23:46
Is there any reason we don't set the x/y here simi
lanwei
2017/01/13 17:29:30
For SyntheticTouchDriver::Release and SyntheticMou
| |
| 212 break; | |
| 213 case SyntheticPointerActionParams::PointerActionType::IDLE: | |
| 214 case SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED: | |
| 215 break; | |
| 200 } | 216 } |
| 201 param_list.push_back(action_param); | 217 param_list.push_back(action_param); |
| 202 return true; | 218 return true; |
| 203 } | 219 } |
| 204 | 220 |
| 205 } // namespace content | 221 } // namespace content |
| OLD | NEW |