OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/test/chromedriver/chrome/web_view_impl.h" | 5 #include "chrome/test/chromedriver/chrome/web_view_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 353 matching lines...) Loading... | |
364 Status status = client_->SendCommand("Input.dispatchMouseEvent", params); | 364 Status status = client_->SendCommand("Input.dispatchMouseEvent", params); |
365 if (status.IsError()) | 365 if (status.IsError()) |
366 return status; | 366 return status; |
367 } | 367 } |
368 return Status(kOk); | 368 return Status(kOk); |
369 } | 369 } |
370 | 370 |
371 Status WebViewImpl::DispatchTouchEvent(const TouchEvent& event) { | 371 Status WebViewImpl::DispatchTouchEvent(const TouchEvent& event) { |
372 base::DictionaryValue params; | 372 base::DictionaryValue params; |
373 params.SetString("type", GetAsString(event.type)); | 373 params.SetString("type", GetAsString(event.type)); |
374 std::unique_ptr<base::ListValue> point_list(new base::ListValue); | 374 std::unique_ptr<base::ListValue> point_list(new base::ListValue); |
vabr (Chromium)
2017/04/25 17:13:15
optional: Move point_list definition immediately p
jdoerrie
2017/04/26 11:34:37
Done.
| |
375 std::unique_ptr<base::DictionaryValue> point(new base::DictionaryValue); | 375 std::unique_ptr<base::DictionaryValue> point(new base::DictionaryValue); |
376 point->SetString("state", GetPointStateString(event.type)); | 376 point->SetString("state", GetPointStateString(event.type)); |
377 point->SetInteger("x", event.x); | 377 point->SetInteger("x", event.x); |
378 point->SetInteger("y", event.y); | 378 point->SetInteger("y", event.y); |
379 point_list->Set(0, point.release()); | 379 point_list->Append(std::move(point)); |
380 params.Set("touchPoints", point_list.release()); | 380 params.Set("touchPoints", point_list.release()); |
381 return client_->SendCommand("Input.dispatchTouchEvent", params); | 381 return client_->SendCommand("Input.dispatchTouchEvent", params); |
382 } | 382 } |
383 | 383 |
384 Status WebViewImpl::DispatchTouchEvents(const std::list<TouchEvent>& events) { | 384 Status WebViewImpl::DispatchTouchEvents(const std::list<TouchEvent>& events) { |
385 for (std::list<TouchEvent>::const_iterator it = events.begin(); | 385 for (std::list<TouchEvent>::const_iterator it = events.begin(); |
386 it != events.end(); ++it) { | 386 it != events.end(); ++it) { |
387 Status status = DispatchTouchEvent(*it); | 387 Status status = DispatchTouchEvent(*it); |
388 if (status.IsError()) | 388 if (status.IsError()) |
389 return status; | 389 return status; |
(...skipping 531 matching lines...) Loading... | |
921 | 921 |
922 if (!cmd_result->GetInteger("nodeId", node_id)) | 922 if (!cmd_result->GetInteger("nodeId", node_id)) |
923 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); | 923 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); |
924 *found_node = true; | 924 *found_node = true; |
925 return Status(kOk); | 925 return Status(kOk); |
926 } | 926 } |
927 | 927 |
928 | 928 |
929 | 929 |
930 } // namespace internal | 930 } // namespace internal |
OLD | NEW |