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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const base::ListValue* pointer_list; | 64 const base::ListValue* pointer_list; |
65 if (!pointer_actions_value_ || | 65 if (!pointer_actions_value_ || |
66 !pointer_actions_value_->GetAsList(&pointer_list)) { | 66 !pointer_actions_value_->GetAsList(&pointer_list)) { |
67 error_message_ = | 67 error_message_ = |
68 base::StringPrintf("pointer_list is missing or not a list"); | 68 base::StringPrintf("pointer_list is missing or not a list"); |
69 return false; | 69 return false; |
70 } | 70 } |
71 | 71 |
72 for (const auto& pointer_value : *pointer_list) { | 72 for (const auto& pointer_value : *pointer_list) { |
73 const base::DictionaryValue* pointer_actions; | 73 const base::DictionaryValue* pointer_actions; |
74 if (!pointer_value->GetAsDictionary(&pointer_actions)) { | 74 if (!pointer_value.GetAsDictionary(&pointer_actions)) { |
75 error_message_ = | 75 error_message_ = |
76 base::StringPrintf("pointer actions is missing or not a dictionary"); | 76 base::StringPrintf("pointer actions is missing or not a dictionary"); |
77 return false; | 77 return false; |
78 } else if (!ParsePointerActions(*pointer_actions)) { | 78 } else if (!ParsePointerActions(*pointer_actions)) { |
79 return false; | 79 return false; |
80 } | 80 } |
81 action_index_++; | 81 action_index_++; |
82 } | 82 } |
83 | 83 |
84 if (!gesture_params_) | 84 if (!gesture_params_) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (!ParseActions(*actions)) | 150 if (!ParseActions(*actions)) |
151 return false; | 151 return false; |
152 | 152 |
153 return true; | 153 return true; |
154 } | 154 } |
155 | 155 |
156 bool ActionsParser::ParseActions(const base::ListValue& actions) { | 156 bool ActionsParser::ParseActions(const base::ListValue& actions) { |
157 SyntheticPointerActionListParams::ParamList param_list; | 157 SyntheticPointerActionListParams::ParamList param_list; |
158 for (const auto& action_value : actions) { | 158 for (const auto& action_value : actions) { |
159 const base::DictionaryValue* action; | 159 const base::DictionaryValue* action; |
160 if (!action_value->GetAsDictionary(&action)) { | 160 if (!action_value.GetAsDictionary(&action)) { |
161 error_message_ = base::StringPrintf( | 161 error_message_ = base::StringPrintf( |
162 "actions[%d].actions is missing or not a dictionary", action_index_); | 162 "actions[%d].actions is missing or not a dictionary", action_index_); |
163 return false; | 163 return false; |
164 } else if (!ParseAction(*action, param_list)) { | 164 } else if (!ParseAction(*action, param_list)) { |
165 return false; | 165 return false; |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 if (param_list.size() > longest_action_sequence_) | 169 if (param_list.size() > longest_action_sequence_) |
170 longest_action_sequence_ = param_list.size(); | 170 longest_action_sequence_ = param_list.size(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // We queue all the IDLE actions in the action parameter list to make sure we | 261 // We queue all the IDLE actions in the action parameter list to make sure we |
262 // will pause long enough on the given pointer. | 262 // will pause long enough on the given pointer. |
263 for (int count = 1; count < num_idle; ++count) | 263 for (int count = 1; count < num_idle; ++count) |
264 param_list.push_back(action_param); | 264 param_list.push_back(action_param); |
265 | 265 |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 } // namespace content | 269 } // namespace content |
OLD | NEW |